[FFmpeg-cvslog] Optimize output buffer size check in base64 decode.
Reimar Döffinger
git at videolan.org
Fri Jan 20 23:29:12 CET 2012
ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Fri Jan 20 22:14:20 2012 +0100| [6af4c9814adb9fd87d2de723473c76e53e2c2b37] | committer: Reimar Döffinger
Optimize output buffer size check in base64 decode.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6af4c9814adb9fd87d2de723473c76e53e2c2b37
---
libavutil/base64.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/libavutil/base64.c b/libavutil/base64.c
index 6843a53..5a7ab4c 100644
--- a/libavutil/base64.c
+++ b/libavutil/base64.c
@@ -47,6 +47,7 @@ int av_base64_decode(uint8_t *out, const char *in, int out_size)
{
int i, v;
uint8_t *dst = out;
+ uint8_t *end = out + out_size;
v = 0;
for (i = 0; ; i++) {
@@ -55,7 +56,7 @@ int av_base64_decode(uint8_t *out, const char *in, int out_size)
return in[i] && in[i] != '=' ? -1 : dst - out;
v = (v << 6) + map2[index];
if (i & 3) {
- if (dst - out < out_size) {
+ if (dst < end) {
*dst++ = v >> (6 - 2 * (i & 3));
}
}
More information about the ffmpeg-cvslog
mailing list