From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 29D2A4873B for ; Sat, 16 Dec 2023 12:16:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 26A2968D103; Sat, 16 Dec 2023 14:16:30 +0200 (EET) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DA8FE68D093 for ; Sat, 16 Dec 2023 14:16:22 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 09C64FF803 for ; Sat, 16 Dec 2023 12:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1702728982; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:in-reply-to:in-reply-to:references:references; bh=wicC0ry7NYdcB0IHLT+7nENP2uR8yQ+tWSZClQcIQNE=; b=NMzzgRwg/MpxxNn58+pG+95i6W/v46mFoIViTTHtkJxSOwJE3n7EO5Di/hzHvw/tpKgI+A jGFeJgjCTpPgbzhqsDJY+SWipkoQngcD0fwrQE2K94zOS+CwasnZeInSwY0sF7+zMiKvUd lZHCoFLir+/6OQftUcCOu8dL0HGDI1aOWOhD21LxV0k0xnh6S3W5F4+f5cye422gLZFXAk UCcQJU5fr2opb2VnVXalmLHe3rbTtsZh/O9470Bkgp3FNSQzmuQT8ICfjqml3YzvyL1ie9 8Oh9rqUHsNQK1na2GhaS1rHE4nMzIjjXiGO3zGoC9WrOMWhhINxdRO05j968Qg== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 16 Dec 2023 13:16:18 +0100 Message-Id: <20231216121619.19436-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231216121619.19436-1-michael@niedermayer.cc> References: <20231216121619.19436-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/jpeglsdec: Check Jpeg-LS LSE X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Fixes: signed integer overflow: 2147478526 + 33924 cannot be represented in type 'int' Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int' Fixes: 64243/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEGLS_fuzzer-5195717848989696 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/jpeglsdec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c index ec163b8964d..c245cf0279c 100644 --- a/libavcodec/jpeglsdec.c +++ b/libavcodec/jpeglsdec.c @@ -382,6 +382,19 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, state->T3 = s->t3; state->reset = s->reset; ff_jpegls_reset_coding_parameters(state, 0); + + /* Testing parameters here, we cannot test in LSE or SOF because + * these interdepend and are allowed in either order + */ + if (state->maxval >= (1<bpp) || + state->T1 > state->T2 || + state->T2 > state->T3 || + state->T3 > state->maxval || + state->reset > FFMAX(255, state->maxval)) { + ret = AVERROR_INVALIDDATA; + goto end; + } + ff_jpegls_init_state(state); if (s->bits <= 8) -- 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".