Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Paul B Mahol <onemda@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH] avcodec/flac_parser: fix triggered assert
Date: Thu, 8 Sep 2022 18:17:23 +0200
Message-ID: <CAPYw7P7wg3NES7mvDqYxp2WzMpb_5sfCvDv+Th+etFjxcZv6DA@mail.gmail.com> (raw)

[-- 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".

             reply	other threads:[~2022-09-08 16:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08 16:17 Paul B Mahol [this message]
2022-09-13  9:28 ` Paul B Mahol
2022-09-13 16:11   ` Mattias Wadman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPYw7P7wg3NES7mvDqYxp2WzMpb_5sfCvDv+Th+etFjxcZv6DA@mail.gmail.com \
    --to=onemda@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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