From: Michael Niedermayer <michael@niedermayer.cc> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: [FFmpeg-devel] [PATCH 1/4] avcodec/rtv1: Check if the minimal size is available in decode_rtv1() Date: Thu, 27 Jul 2023 01:59:13 +0200 Message-ID: <20230726235916.30058-1-michael@niedermayer.cc> (raw) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/rtv1.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/rtv1.c b/libavcodec/rtv1.c index 4b202e6a21..95fa9210d8 100644 --- a/libavcodec/rtv1.c +++ b/libavcodec/rtv1.c @@ -44,6 +44,8 @@ static int decode_rtv1(GetByteContext *gb, uint8_t *dst, ptrdiff_t linesize, uint8_t block[8] = { 0 }; int run = 0; + if (bytestream2_get_bytes_left(gb) < (width / 4) * (height / 4) / 0xFFFF * 4) + return AVERROR_INVALIDDATA; for (int y = 0; y < height; y += 4) { for (int x = 0; x < width * 4; x += 16) { int mode = 0; @@ -126,7 +128,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, dst = p->data[0] + p->linesize[0] * (avctx->coded_height - 1); linesize = -p->linesize[0]; - decode_rtv1(&gb, dst, linesize, width, height, flags, dsp->dxt1_block); + ret = decode_rtv1(&gb, dst, linesize, width, height, flags, dsp->dxt1_block); + if (ret < 0) + return ret; p->pict_type = AV_PICTURE_TYPE_I; p->flags |= AV_FRAME_FLAG_KEY; -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2023-07-26 23:59 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-26 23:59 Michael Niedermayer [this message] 2023-07-26 23:59 ` [FFmpeg-devel] [PATCH 2/4] tools/target_dec_fuzzer: Adjust threshold for rtv1 Michael Niedermayer 2023-07-26 23:59 ` [FFmpeg-devel] [PATCH 3/4] avcodec/vvc_parser: Avoid undefined overflow in POC computation Michael Niedermayer 2023-07-26 23:59 ` [FFmpeg-devel] [PATCH 4/4] avcodec/evc_ps: Check num_ref_pic_list_in_sps Michael Niedermayer 2023-07-27 0:19 ` James Almer 2023-07-27 17:38 ` Michael Niedermayer 2023-09-22 19:22 ` [FFmpeg-devel] [PATCH 1/4] avcodec/rtv1: Check if the minimal size is available in decode_rtv1() Michael Niedermayer 2023-09-22 19:32 ` Paul B Mahol 2023-09-22 21:26 ` Michael Niedermayer 2023-09-22 21:30 ` Paul B Mahol 2023-09-22 21:52 ` Michael Niedermayer 2023-09-22 22:01 ` Paul B Mahol 2023-09-22 22:33 ` Michael Niedermayer 2023-09-22 22:46 ` Paul B Mahol
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230726235916.30058-1-michael@niedermayer.cc \ --to=michael@niedermayer.cc \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git