mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
avcodec/vp3: ensure header is parsed successfully before tables
Fixes assertion failure
Fixes: 266ee543812e934f7b4a72923a2701d4/signal_sigabrt_7ffff6ae7cc9_7322_85218d61759d461bdf7387180e8000c9.ogg
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 26379d4fdd
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
0f331f94c0
commit
548a07cdc4
@ -131,7 +131,7 @@ static const uint8_t hilbert_offset[16][2] = {
|
|||||||
|
|
||||||
typedef struct Vp3DecodeContext {
|
typedef struct Vp3DecodeContext {
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
int theora, theora_tables;
|
int theora, theora_tables, theora_header;
|
||||||
int version;
|
int version;
|
||||||
int width, height;
|
int width, height;
|
||||||
int chroma_x_shift, chroma_y_shift;
|
int chroma_x_shift, chroma_y_shift;
|
||||||
@ -2251,6 +2251,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
|
|||||||
int ret;
|
int ret;
|
||||||
AVRational fps, aspect;
|
AVRational fps, aspect;
|
||||||
|
|
||||||
|
s->theora_header = 0;
|
||||||
s->theora = get_bits_long(gb, 24);
|
s->theora = get_bits_long(gb, 24);
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
|
av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
|
||||||
|
|
||||||
@ -2356,6 +2357,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
|
|||||||
avctx->color_trc = AVCOL_TRC_BT709;
|
avctx->color_trc = AVCOL_TRC_BT709;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s->theora_header = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2364,6 +2366,9 @@ static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb)
|
|||||||
Vp3DecodeContext *s = avctx->priv_data;
|
Vp3DecodeContext *s = avctx->priv_data;
|
||||||
int i, n, matrices, inter, plane;
|
int i, n, matrices, inter, plane;
|
||||||
|
|
||||||
|
if (!s->theora_header)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if (s->theora >= 0x030200) {
|
if (s->theora >= 0x030200) {
|
||||||
n = get_bits(gb, 3);
|
n = get_bits(gb, 3);
|
||||||
/* loop filter limit values table */
|
/* loop filter limit values table */
|
||||||
|
Loading…
Reference in New Issue
Block a user