Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-09-08 10:59:09 +0300
committerPaul B Mahol <onemda@gmail.com>2022-09-13 18:43:15 +0300
commitcf2cf31805448dd11692313440a21821773a6128 (patch)
tree2c315a8c3543dac165e2e43e766a5f1e06d02452 /libavcodec/flac_parser.c
parent9ad3db3ad932d484708194f419544c33cb3c71e6 (diff)
avcodec/flac_parser: avoid returning too negative number
If return value is very small parser code will assert.
Diffstat (limited to 'libavcodec/flac_parser.c')
-rw-r--r--libavcodec/flac_parser.c7
1 files 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;
}