diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-11 15:16:29 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-11 15:32:00 +0200 |
commit | dbf5d7e5cd16d4f02b57c24922b1f77755c0427b (patch) | |
tree | 933285b5e18be673b5b9b9c3cc2a04831858fb04 | |
parent | 6badd558ce19dffe8c3ea3e687812b933e0cb2ff (diff) | |
download | ffmpeg-dbf5d7e5cd16d4f02b57c24922b1f77755c0427b.tar.gz |
avcodec/huffyuvdec: fix overread checks
Fixes: ffvhuff_f.avi
Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ba47d519e537299179d20b9a599c5824589a3f7a)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/huffyuvdec.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 74872d2caa..662095f909 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -625,9 +625,9 @@ static void decode_422_bitstream(HYuvContext *s, int count) READ_2PIX(s->temp[0][2 * i ], s->temp[1][i], 1); READ_2PIX(s->temp[0][2 * i + 1], s->temp[2][i], 2); } - for (; i < count && get_bits_left(&s->gb) > 0; i++) { + for (; i < count && BITS_LEFT(re, &s->gb) > 0; i++) { READ_2PIX(s->temp[0][2 * i ], s->temp[1][i], 1); - if (get_bits_left(&s->gb) <= 0) break; + if (BITS_LEFT(re, &s->gb) <= 0) break; READ_2PIX(s->temp[0][2 * i + 1], s->temp[2][i], 2); } for (; i < count; i++) @@ -666,7 +666,7 @@ static void decode_plane_bitstream(HYuvContext *s, int count, int plane) if (s->bps <= 8) { OPEN_READER(re, &s->gb); if (count >= (get_bits_left(&s->gb)) / (32 * 2)) { - for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) { + for (i = 0; i < count && BITS_LEFT(re, &s->gb) > 0; i++) { READ_2PIX_PLANE(s->temp[0][2 * i], s->temp[0][2 * i + 1], plane, OP8bits); } } else { @@ -678,7 +678,7 @@ static void decode_plane_bitstream(HYuvContext *s, int count, int plane) } else if (s->bps <= 14) { OPEN_READER(re, &s->gb); if (count >= (get_bits_left(&s->gb)) / (32 * 2)) { - for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) { + for (i = 0; i < count && BITS_LEFT(re, &s->gb) > 0; i++) { READ_2PIX_PLANE(s->temp16[0][2 * i], s->temp16[0][2 * i + 1], plane, OP14bits); } } else { @@ -707,7 +707,7 @@ static void decode_gray_bitstream(HYuvContext *s, int count) count/=2; if (count >= (get_bits_left(&s->gb)) / (32 * 2)) { - for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) { + for (i = 0; i < count && BITS_LEFT(re, &s->gb) > 0; i++) { READ_2PIX(s->temp[0][2 * i], s->temp[0][2 * i + 1], 0); } } else { @@ -724,7 +724,7 @@ static av_always_inline void decode_bgr_1(HYuvContext *s, int count, int i; OPEN_READER(re, &s->gb); - for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) { + for (i = 0; i < count && BITS_LEFT(re, &s->gb) > 0; i++) { unsigned int index; int code, n; |