From 9fc141f32d52099a6bfeba6e4e7ee2ce7fadc833 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 18 Jun 2023 23:50:16 +0200 Subject: [PATCH] avformat/jpegxl_anim_dec: Perform operations in a different order Fixes: OOM Fixes: 59802/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-5681765466112000 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/jpegxl_anim_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/jpegxl_anim_dec.c b/libavformat/jpegxl_anim_dec.c index ec400c955c..8d6ea5005c 100644 --- a/libavformat/jpegxl_anim_dec.c +++ b/libavformat/jpegxl_anim_dec.c @@ -231,7 +231,7 @@ static int jpegxl_anim_read_packet(AVFormatContext *s, AVPacket *pkt) if (ctx->initial && size < ctx->initial->size) size = ctx->initial->size; - if ((ret = av_new_packet(pkt, size) < 0)) + if ((ret = av_new_packet(pkt, size)) < 0) return ret; if (ctx->initial) {