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] avcodec/speexdec: check for sane s->frame_size values
@ 2024-02-16 14:19 James Almer
  2024-02-16 17:48 ` Michael Niedermayer
  0 siblings, 1 reply; 2+ messages in thread
From: James Almer @ 2024-02-16 14:19 UTC (permalink / raw)
  To: ffmpeg-devel

Fixes heap buffer overflows

Reported-by: sploitem <sploitem@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/speexdec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/speexdec.c b/libavcodec/speexdec.c
index 51c5834769..4d8052d585 100644
--- a/libavcodec/speexdec.c
+++ b/libavcodec/speexdec.c
@@ -1420,7 +1420,10 @@ static int parse_speex_extradata(AVCodecContext *avctx,
     if (s->nb_channels <= 0 || s->nb_channels > 2)
         return AVERROR_INVALIDDATA;
     s->bitrate = bytestream_get_le32(&buf);
-    s->frame_size = (1 + (s->mode > 0)) * bytestream_get_le32(&buf);
+    s->frame_size = bytestream_get_le32(&buf);
+    if (s->frame_size < NB_FRAME_SIZE << (s->mode > 0))
+        return AVERROR_INVALIDDATA;
+    s->frame_size *= 1 + (s->mode > 0);
     s->vbr = bytestream_get_le32(&buf);
     s->frames_per_packet = bytestream_get_le32(&buf);
     if (s->frames_per_packet <= 0 ||
-- 
2.43.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] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/speexdec: check for sane s->frame_size values
  2024-02-16 14:19 [FFmpeg-devel] [PATCH] avcodec/speexdec: check for sane s->frame_size values James Almer
@ 2024-02-16 17:48 ` Michael Niedermayer
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Niedermayer @ 2024-02-16 17:48 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 586 bytes --]

On Fri, Feb 16, 2024 at 11:19:25AM -0300, James Almer wrote:
> Fixes heap buffer overflows
> 
> Reported-by: sploitem <sploitem@gmail.com>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/speexdec.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

ok, though note that i do not know speexdec.c well enough to say that this
is or is not sufficient

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2024-02-16 17:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16 14:19 [FFmpeg-devel] [PATCH] avcodec/speexdec: check for sane s->frame_size values James Almer
2024-02-16 17:48 ` 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