| OLD | NEW |
| (Empty) | |
| 1 commit baa697105bd3e754076573ada39d3382c8f6968a |
| 2 Author: reimar <reimar@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b> |
| 3 Date: Mon Jul 6 09:22:39 2009 +0000 |
| 4 |
| 5 Make decode_init fail if the huffman tables are invalid and thus init_vlc fa
ils. |
| 6 Otherwise this will crash during decoding because the vlc tables are NULL. |
| 7 Partially fixes ogv/smclock.ogv.1.101.ogv from issue 1240. |
| 8 |
| 9 |
| 10 git-svn-id: file:///var/local/repositories/ffmpeg/trunk@19355 9553f0bf-9b14-
0410-a0b8-cfaf0461ba5b |
| 11 |
| 12 diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c |
| 13 index ad32cc9..3f45428 100644 |
| 14 --- a/libavcodec/vp3.c |
| 15 +++ b/libavcodec/vp3.c |
| 16 @@ -1788,29 +1788,34 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx
) |
| 17 for (i = 0; i < 16; i++) { |
| 18 |
| 19 /* DC histograms */ |
| 20 - init_vlc(&s->dc_vlc[i], 5, 32, |
| 21 + if (init_vlc(&s->dc_vlc[i], 5, 32, |
| 22 &s->huffman_table[i][0][1], 4, 2, |
| 23 - &s->huffman_table[i][0][0], 4, 2, 0); |
| 24 + &s->huffman_table[i][0][0], 4, 2, 0) < 0) |
| 25 + goto vlc_fail; |
| 26 |
| 27 /* group 1 AC histograms */ |
| 28 - init_vlc(&s->ac_vlc_1[i], 5, 32, |
| 29 + if (init_vlc(&s->ac_vlc_1[i], 5, 32, |
| 30 &s->huffman_table[i+16][0][1], 4, 2, |
| 31 - &s->huffman_table[i+16][0][0], 4, 2, 0); |
| 32 + &s->huffman_table[i+16][0][0], 4, 2, 0) < 0) |
| 33 + goto vlc_fail; |
| 34 |
| 35 /* group 2 AC histograms */ |
| 36 - init_vlc(&s->ac_vlc_2[i], 5, 32, |
| 37 + if (init_vlc(&s->ac_vlc_2[i], 5, 32, |
| 38 &s->huffman_table[i+16*2][0][1], 4, 2, |
| 39 - &s->huffman_table[i+16*2][0][0], 4, 2, 0); |
| 40 + &s->huffman_table[i+16*2][0][0], 4, 2, 0) < 0) |
| 41 + goto vlc_fail; |
| 42 |
| 43 /* group 3 AC histograms */ |
| 44 - init_vlc(&s->ac_vlc_3[i], 5, 32, |
| 45 + if (init_vlc(&s->ac_vlc_3[i], 5, 32, |
| 46 &s->huffman_table[i+16*3][0][1], 4, 2, |
| 47 - &s->huffman_table[i+16*3][0][0], 4, 2, 0); |
| 48 + &s->huffman_table[i+16*3][0][0], 4, 2, 0) < 0) |
| 49 + goto vlc_fail; |
| 50 |
| 51 /* group 4 AC histograms */ |
| 52 - init_vlc(&s->ac_vlc_4[i], 5, 32, |
| 53 + if (init_vlc(&s->ac_vlc_4[i], 5, 32, |
| 54 &s->huffman_table[i+16*4][0][1], 4, 2, |
| 55 - &s->huffman_table[i+16*4][0][0], 4, 2, 0); |
| 56 + &s->huffman_table[i+16*4][0][0], 4, 2, 0) < 0) |
| 57 + goto vlc_fail; |
| 58 } |
| 59 } |
| 60 |
| 61 @@ -1844,6 +1849,10 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) |
| 62 } |
| 63 |
| 64 return 0; |
| 65 + |
| 66 +vlc_fail: |
| 67 + av_log(avctx, AV_LOG_FATAL, "Invalid huffman table\n"); |
| 68 + return -1; |
| 69 } |
| 70 |
| 71 /* |
| OLD | NEW |