[FFmpeg-cvslog] avcodec/flac_parser: avoid returning too negative number
Paul B Mahol
git at videolan.org
Tue Sep 13 18:41:15 EEST 2022
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Sep 8 09:59:09 2022 +0200| [cf2cf31805448dd11692313440a21821773a6128] | committer: Paul B Mahol
avcodec/flac_parser: avoid returning too negative number
If return value is very small parser code will assert.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf2cf31805448dd11692313440a21821773a6128
---
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;
}
More information about the ffmpeg-cvslog
mailing list