Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/6] avcodec/eatgq: : Check index increments in tgq_decode_block()
@ 2023-01-11 23:54 Michael Niedermayer
  2023-01-11 23:54 ` [FFmpeg-devel] [PATCH 2/6] avcodec/pngdec: Check deloco index more exactly Michael Niedermayer
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Michael Niedermayer @ 2023-01-11 23:54 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: out of array access
Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATGQ_fuzzer-6743211456724992

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/eatgq.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c
index 89e9f20880..beb9f4d046 100644
--- a/libavcodec/eatgq.c
+++ b/libavcodec/eatgq.c
@@ -56,7 +56,7 @@ static av_cold int tgq_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
+static int tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
 {
     const uint8_t *scantable = ff_zigzag_direct;
     int i, j, value;
@@ -64,6 +64,8 @@ static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb
     for (i = 1; i < 64;) {
         switch (show_bits(gb, 3)) {
         case 4:
+            if (i >= 63)
+                return AVERROR_INVALIDDATA;
             block[scantable[i++]] = 0;
         case 0:
             block[scantable[i++]] = 0;
@@ -73,6 +75,8 @@ static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb
         case 1:
             skip_bits(gb, 2);
             value = get_bits(gb, 6);
+            if (value > 64 - i)
+                return AVERROR_INVALIDDATA;
             for (j = 0; j < value; j++)
                 block[scantable[i++]] = 0;
             break;
@@ -100,6 +104,7 @@ static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb
         }
     }
     block[0] += 128 << 4;
+    return 0;
 }
 
 static void tgq_idct_put_mb(TgqContext *s, int16_t (*block)[64], AVFrame *frame,
-- 
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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-02-23 22:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-11 23:54 [FFmpeg-devel] [PATCH 1/6] avcodec/eatgq: : Check index increments in tgq_decode_block() Michael Niedermayer
2023-01-11 23:54 ` [FFmpeg-devel] [PATCH 2/6] avcodec/pngdec: Check deloco index more exactly Michael Niedermayer
2023-02-23 22:21   ` Michael Niedermayer
2023-01-11 23:54 ` [FFmpeg-devel] [PATCH 3/6] avcodec/pngdec: dont skip/read chunk twice Michael Niedermayer
2023-02-23 22:22   ` Michael Niedermayer
2023-01-11 23:54 ` [FFmpeg-devel] [PATCH 4/6] avcodec/sgidec: do not forget the number of components in read_uncompressed_sgi() Michael Niedermayer
2023-01-12  0:02   ` Andreas Rheinhardt
2023-01-12 14:28     ` Michael Niedermayer
2023-01-11 23:54 ` [FFmpeg-devel] [PATCH 5/6] avcodec/videodsp_template: Adjust pointers to avoid undefined pointer things Michael Niedermayer
2023-02-23 22:23   ` Michael Niedermayer
2023-01-11 23:54 ` [FFmpeg-devel] [PATCH 6/6] avcodec/tiff: do not try to read a value from a 0 value linearization table Michael Niedermayer
2023-01-15  2:50 ` [FFmpeg-devel] [PATCH 1/6] avcodec/eatgq: : Check index increments in tgq_decode_block() Peter Ross
2023-01-15 17:21   ` Michael Niedermayer

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