summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald S. Bultje <[email protected]>2012-02-17 15:00:47 -0800
committerReinhard Tartler <[email protected]>2012-04-01 18:33:26 +0200
commit2380a3d37f0b94436db53aa56491cbc9203bc8fe (patch)
tree3cd5e523f709dcc1b51efac524411b0ad5743dfd
parent4509129e9d04c93a3de4005787a058d1b950eb03 (diff)
huffyuv: error out on bit overrun.
On EOF, get_bits() will continuously return 0, causing an infinite loop. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: [email protected] (cherry picked from commit 84c202cc37024bd78261e4222e46631ea73c48dd) Signed-off-by: Anton Khirnov <[email protected]> Signed-off-by: Reinhard Tartler <[email protected]>
-rw-r--r--libavcodec/huffyuv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index a399142d59..d211964eca 100644
--- a/libavcodec/huffyuv.c
+++ b/libavcodec/huffyuv.c
@@ -184,7 +184,7 @@ static int read_len_table(uint8_t *dst, GetBitContext *gb){
if(repeat==0)
repeat= get_bits(gb, 8);
//printf("%d %d\n", val, repeat);
- if(i+repeat > 256) {
+ if(i+repeat > 256 || get_bits_left(gb) < 0) {
av_log(NULL, AV_LOG_ERROR, "Error reading huffman table\n");
return -1;
}