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 01/11] avcodec/adpcm: Fix integer overflow in intermediate in ADPCM_XMD
@ 2023-04-16 16:48 Michael Niedermayer
  2023-04-16 16:48 ` [FFmpeg-devel] [PATCH 02/11] avcodec/pngdec: remove AVFrame argument from decode_iccp_chunk() Michael Niedermayer
                   ` (11 more replies)
  0 siblings, 12 replies; 22+ messages in thread
From: Michael Niedermayer @ 2023-04-16 16:48 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: runtime error: signed integer overflow: 2140143616 + 254665816 cannot be represented in type 'int'
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_XMD_fuzzer-6690181676924928

As a sideeffect this simplifies the equation, the high bits are different after this but only
the low 16bits are stored and used in later steps.
The change is untested as there are no fate testcases, no sample files on the server, no links on
the mailing list and no reports on trac referencing this format that i could find.

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

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 451696932d1..d8f334cf5a0 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1579,11 +1579,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                     nibble[0] = sign_extend(byte & 15, 4);
                     nibble[1] = sign_extend(byte >> 4, 4);
 
-                    out[2+n*2] = (nibble[0]*(scale<<14) + (history[0]*29336) - (history[1]*13136)) >> 14;
+                    out[2+n*2  ] = nibble[0]*scale + ((history[0]*3667 - history[1]*1642) >> 11);
                     history[1] = history[0];
                     history[0] = out[2+n*2];
 
-                    out[2+n*2+1] = (nibble[1]*(scale<<14) + (history[0]*29336) - (history[1]*13136)) >> 14;
+                    out[2+n*2+1] = nibble[1]*scale + ((history[0]*3667 - history[1]*1642) >> 11);
                     history[1] = history[0];
                     history[0] = out[2+n*2+1];
                 }
-- 
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] 22+ messages in thread

end of thread, other threads:[~2023-05-06 15:18 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-16 16:48 [FFmpeg-devel] [PATCH 01/11] avcodec/adpcm: Fix integer overflow in intermediate in ADPCM_XMD Michael Niedermayer
2023-04-16 16:48 ` [FFmpeg-devel] [PATCH 02/11] avcodec/pngdec: remove AVFrame argument from decode_iccp_chunk() Michael Niedermayer
2023-04-16 16:48 ` [FFmpeg-devel] [PATCH 03/11] avcodec/pngdec: Do not pass AVFrame into global header decode Michael Niedermayer
2023-04-16 16:48 ` [FFmpeg-devel] [PATCH 04/11] avcodec/exr: Cleanup befor return Michael Niedermayer
2023-04-16 16:48 ` [FFmpeg-devel] [PATCH 05/11] avcodec/flacdec: Fix signed integre overflow Michael Niedermayer
2023-05-05 22:36   ` James Almer
2023-05-06 15:08     ` Michael Niedermayer
2023-05-06 15:18       ` James Almer
2023-04-16 16:48 ` [FFmpeg-devel] [PATCH 06/11] avcodec/utils: the IFF_ILBM implementation assumes that there are a multiple of 16 allocated Michael Niedermayer
2023-04-16 16:48 ` [FFmpeg-devel] [PATCH 07/11] avcodec/sonic: Fix two undefined integer overflows Michael Niedermayer
2023-04-16 16:48 ` [FFmpeg-devel] [PATCH 08/11] avcodec/tak: Check remaining bits in ff_tak_decode_frame_header() Michael Niedermayer
2023-04-16 16:48 ` [FFmpeg-devel] [PATCH 09/11] avcodec/tiff: add a zero DNG_LINEARIZATION_TABLE check Michael Niedermayer
2023-04-16 16:48 ` [FFmpeg-devel] [PATCH 10/11] avcodec/dpcm: fix undefined interger overflow in wady Michael Niedermayer
2023-04-16 16:48 ` [FFmpeg-devel] [PATCH 11/11] avcodec/wavarc: Check order before using it to write the list Michael Niedermayer
2023-04-30 20:04   ` Michael Niedermayer
2023-04-17  7:04 ` [FFmpeg-devel] [PATCH 01/11] avcodec/adpcm: Fix integer overflow in intermediate in ADPCM_XMD Paul B Mahol
2023-04-17 22:45   ` Michael Niedermayer
2023-05-05 22:15     ` Michael Niedermayer
2023-05-05 22:24       ` Paul B Mahol
2023-05-05 22:31         ` Michael Niedermayer
2023-04-17  7:27 ` Paul B Mahol
2023-04-17 11:42   ` 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