diff options
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/afc.c | 4 | ||||
-rw-r--r-- | libavformat/avidec.c | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/afc.c b/libavformat/afc.c index a99f65472d..102b74baeb 100644 --- a/libavformat/afc.c +++ b/libavformat/afc.c @@ -57,10 +57,10 @@ static int afc_read_header(AVFormatContext *s) static int afc_read_packet(AVFormatContext *s, AVPacket *pkt) { AFCDemuxContext *c = s->priv_data; - int64_t size; + int64_t size = c->data_end - avio_tell(s->pb); int ret; - size = FFMIN(c->data_end - avio_tell(s->pb), 18 * 128); + size = FFMIN(size, 18 * 128); if (size <= 0) return AVERROR_EOF; diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 39039f5bc9..2e261c94e6 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -362,7 +362,8 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end) uint16_t size = avio_rl16(s->pb); const char *name = NULL; char buffer[64] = { 0 }; - size = FFMIN(size, tag_end - avio_tell(s->pb)); + uint64_t remaining = tag_end - avio_tell(s->pb); + size = FFMIN(size, remaining); size -= avio_read(s->pb, buffer, FFMIN(size, sizeof(buffer) - 1)); switch (tag) { |