diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-29 18:05:10 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-29 18:18:51 +0100 |
commit | 4420b414420ecd67e63820c556c8cadee0cc13c8 (patch) | |
tree | d4a71c66278b2818aa294ebda1ed0de3dc9d4342 | |
parent | f67a0d115254461649470452058fa3c28c0df294 (diff) | |
download | ffmpeg-streaming-4420b414420ecd67e63820c556c8cadee0cc13c8.zip ffmpeg-streaming-4420b414420ecd67e63820c556c8cadee0cc13c8.tar.gz |
huffyuvdec: check for and propagate failures from inside generate_joint_tables()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/huffyuvdec.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 0bdd143..d11dab7 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -107,11 +107,13 @@ static int read_len_table(uint8_t *dst, GetBitContext *gb) return 0; } -static void generate_joint_tables(HYuvContext *s) +static int generate_joint_tables(HYuvContext *s) { uint16_t symbols[1 << VLC_BITS]; uint16_t bits[1 << VLC_BITS]; uint8_t len[1 << VLC_BITS]; + int ret; + if (s->bitstream_bpp < 24) { int p, i, y, u; for (p = 0; p < 3; p++) { @@ -133,8 +135,9 @@ static void generate_joint_tables(HYuvContext *s) } } ff_free_vlc(&s->vlc[3 + p]); - ff_init_vlc_sparse(&s->vlc[3 + p], VLC_BITS, i, len, 1, 1, - bits, 2, 2, symbols, 2, 2, 0); + if ((ret = ff_init_vlc_sparse(&s->vlc[3 + p], VLC_BITS, i, len, 1, 1, + bits, 2, 2, symbols, 2, 2, 0)) < 0) + return ret; } } else { uint8_t (*map)[4] = (uint8_t(*)[4])s->pix_bgr_map; @@ -176,8 +179,10 @@ static void generate_joint_tables(HYuvContext *s) } } ff_free_vlc(&s->vlc[3]); - init_vlc(&s->vlc[3], VLC_BITS, i, len, 1, 1, bits, 2, 2, 0); + if ((ret = init_vlc(&s->vlc[3], VLC_BITS, i, len, 1, 1, bits, 2, 2, 0)) < 0) + return ret; } + return 0; } static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length) @@ -200,7 +205,8 @@ static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length) return ret; } - generate_joint_tables(s); + if ((ret = generate_joint_tables(s)) < 0) + return ret; return (get_bits_count(&gb) + 7) / 8; } @@ -238,7 +244,8 @@ static int read_old_huffman_tables(HYuvContext *s) return ret; } - generate_joint_tables(s); + if ((ret = generate_joint_tables(s)) < 0) + return ret; return 0; } |