diff mbox series

[FFmpeg-devel,2/4] avformat/id3v2: Check taglen in read_uslt()

Message ID 20221118210918.3169-2-michael@niedermayer.cc
State Accepted
Commit a798af91d7d1fc31cfc1ae09cc6ab3907304f44f
Headers show
Series [FFmpeg-devel,1/4] avcodec/tiff: Ignore tile_count | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Nov. 18, 2022, 9:09 p.m. UTC
Fixes: Timeout (read mostly the same data repeatly)
Fixes: 52457/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-6610706313379840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/id3v2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Nov. 28, 2022, 7:47 p.m. UTC | #1
On Fri, Nov 18, 2022 at 10:09:16PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout (read mostly the same data repeatly)
> Fixes: 52457/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-6610706313379840
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/id3v2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 191a305ffb..cb31864045 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -377,10 +377,10 @@  static void read_uslt(AVFormatContext *s, AVIOContext *pb, int taglen,
     lang[3] = '\0';
     taglen -= 3;
 
-    if (decode_str(s, pb, encoding, &descriptor, &taglen) < 0)
+    if (decode_str(s, pb, encoding, &descriptor, &taglen) < 0 || taglen < 0)
         goto error;
 
-    if (decode_str(s, pb, encoding, &text, &taglen) < 0)
+    if (decode_str(s, pb, encoding, &text, &taglen) < 0 || taglen < 0)
         goto error;
 
     // FFmpeg does not support hierarchical metadata, so concatenate the keys.