Unified · Split
| @@ -90,6 +90,7 @@ typedef struct G2MContext { · 89 unmodified lines | |||
| 90 | 90 | ||
| 91 | int compression; | 91 | int compression; |
| 92 | int width, height, bpp; | 92 | int width, height, bpp; |
| 93 | int orig_width, orig_height; | ||
| 93 | int tile_width, tile_height; | 94 | int tile_width, tile_height; |
| 94 | int tiles_x, tiles_y, tile_x, tile_y; | 95 | int tiles_x, tiles_y, tile_x, tile_y; |
| 95 | 96 | ||
| @@ -710,8 +711,8 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data, · 614 unmodified lines | |||
| 710 | } | 711 | } |
| 711 | c->width = bytestream2_get_be32(&bc); | 712 | c->width = bytestream2_get_be32(&bc); |
| 712 | c->height = bytestream2_get_be32(&bc); | 713 | c->height = bytestream2_get_be32(&bc); |
| 713 | if (c->width < 16 || c->width > avctx->width || | 714 | if (c->width < 16 || c->width > c->orig_width || |
| 714 | c->height < 16 || c->height > avctx->height) { | 715 | c->height < 16 || c->height > c->orig_height) { |
| 715 | av_log(avctx, AV_LOG_ERROR, | 716 | av_log(avctx, AV_LOG_ERROR, |
| 716 | "Invalid frame dimensions %dx%d\n", | 717 | "Invalid frame dimensions %dx%d\n", |
| 717 | c->width, c->height); | 718 | c->width, c->height); |
| @@ -875,6 +876,10 @@ static av_cold int g2m_decode_init(AVCodecContext *avctx) · 157 unmodified lines | |||
| 875 | 876 | ||
| 876 | avctx->pix_fmt = AV_PIX_FMT_RGB24; | 877 | avctx->pix_fmt = AV_PIX_FMT_RGB24; |
| 877 | 878 | ||
| 879 | // store original sizes and check against those if resize happens | ||
| 880 | c->orig_width = avctx->width; | ||
| 881 | c->orig_height = avctx->height; | ||
| 882 | |||
| 878 | return 0; | 883 | return 0; |
| 879 | } | 884 | } |
| 880 | 885 | ||