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/flac_parser: fix triggered assert
@ 2022-09-08 16:17 Paul B Mahol
  2022-09-13  9:28 ` Paul B Mahol
  0 siblings, 1 reply; 3+ messages in thread
From: Paul B Mahol @ 2022-09-08 16:17 UTC (permalink / raw)
  To: ffmpeg-devel

[-- Attachment #1: Type: text/plain, Size: 16 bytes --]

Patch attached.

[-- Attachment #2: 0001-avcodec-flac_parser-avoid-returning-too-negative-num.patch --]
[-- Type: text/x-patch, Size: 1100 bytes --]

From a726d0a26c9f60d65167a83789f9c222cfda5728 Mon Sep 17 00:00:00 2001
From: Paul B Mahol <onemda@gmail.com>
Date: Thu, 8 Sep 2022 09:59:09 +0200
Subject: [PATCH] avcodec/flac_parser: avoid returning too negative number

If return value is very small parser code will assert.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/flac_parser.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 5b3a4e6e67..bd91cc1a05 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -663,8 +663,11 @@ static int get_best_header(FLACParseContext *fpc, const uint8_t **poutbuf,
 
     /* Return the negative overread index so the client can compute pos.
        This should be the amount overread to the beginning of the child */
-    if (child)
-        return child->offset - flac_fifo_size(&fpc->fifo_buf);
+    if (child) {
+        int64_t offset = child->offset - flac_fifo_size(&fpc->fifo_buf);
+        if (offset > -(1 << 28))
+            return offset;
+    }
     return 0;
 }
 
-- 
2.37.2


[-- Attachment #3: 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] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/flac_parser: fix triggered assert
  2022-09-08 16:17 [FFmpeg-devel] [PATCH] avcodec/flac_parser: fix triggered assert Paul B Mahol
@ 2022-09-13  9:28 ` Paul B Mahol
  2022-09-13 16:11   ` Mattias Wadman
  0 siblings, 1 reply; 3+ messages in thread
From: Paul B Mahol @ 2022-09-13  9:28 UTC (permalink / raw)
  To: ffmpeg-devel

On 9/8/22, Paul B Mahol <onemda@gmail.com> wrote:
> Patch attached.
>

Will apply soon.
_______________________________________________
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] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/flac_parser: fix triggered assert
  2022-09-13  9:28 ` Paul B Mahol
@ 2022-09-13 16:11   ` Mattias Wadman
  0 siblings, 0 replies; 3+ messages in thread
From: Mattias Wadman @ 2022-09-13 16:11 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Tue, Sep 13, 2022 at 11:28 AM Paul B Mahol <onemda@gmail.com> wrote:

> On 9/8/22, Paul B Mahol <onemda@gmail.com> wrote:
> > Patch attached.
> >
>
> Will apply soon.


Curious where the 1 << 28 constant come from?
_______________________________________________
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] 3+ messages in thread

end of thread, other threads:[~2022-09-13 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08 16:17 [FFmpeg-devel] [PATCH] avcodec/flac_parser: fix triggered assert Paul B Mahol
2022-09-13  9:28 ` Paul B Mahol
2022-09-13 16:11   ` Mattias Wadman

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