diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2013-06-11 18:34:26 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2013-06-12 09:54:45 +0200 |
commit | 767ae86ceeae9c29ed6e62066e9577f0b0598650 (patch) | |
tree | 61fbee71c4542af0a11afc15f5b3c3337655b59c | |
parent | 84d3ff50cd679e0f35f0b7ce2cb2cedd99169959 (diff) | |
download | ffmpeg-767ae86ceeae9c29ed6e62066e9577f0b0598650.tar.gz |
g2meet: reset dimensions on header parsing errors
-rw-r--r-- | libavcodec/g2meet.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index 72c062c86d..d0a4302fd7 100644 --- a/libavcodec/g2meet.c +++ b/libavcodec/g2meet.c @@ -646,8 +646,8 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "Invalid frame dimensions %dx%d\n", c->width, c->height); - c->width = c->height = 0; - bytestream2_skip(&bc, bytestream2_get_bytes_left(&bc)); + ret = AVERROR_INVALIDDATA; + goto header_fail; } if (c->width != avctx->width || c->height != avctx->height) avcodec_set_dimensions(avctx, c->width, c->height); @@ -664,15 +664,18 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "Invalid tile dimensions %dx%d\n", c->tile_width, c->tile_height); - return AVERROR_INVALIDDATA; + ret = AVERROR_INVALIDDATA; + goto header_fail; } c->tiles_x = (c->width + c->tile_width - 1) / c->tile_width; c->tiles_y = (c->height + c->tile_height - 1) / c->tile_height; c->bpp = bytestream2_get_byte(&bc); chunk_size -= 21; bytestream2_skip(&bc, chunk_size); - if (g2m_init_buffers(c)) - return AVERROR(ENOMEM); + if (g2m_init_buffers(c)) { + ret = AVERROR(ENOMEM); + goto header_fail; + } got_header = 1; break; case TILE_DATA: @@ -778,6 +781,10 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data, } return buf_size; +header_fail: + c->width = c->height = 0; + c->tiles_x = c->tiles_y = 0; + return ret; } static av_cold int g2m_decode_init(AVCodecContext *avctx) |