aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-28 23:46:04 +0300
committerLuca Barbato <lu_zero@gentoo.org>2014-01-07 09:43:57 +0100
commit213b8aa0a90585f13aebb7fba39cbd3e367e98a6 (patch)
tree89fe5ab7538272d24557026c9eb9c172d8cb379b
parent5e8243e843be8f71da7dde199a71d095726533eb (diff)
downloadffmpeg-213b8aa0a90585f13aebb7fba39cbd3e367e98a6.tar.gz
bfi: Add some very basic sanity checks for input packet sizes
CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st> (cherry picked from commit 640a2427aafa774b83316b7a8c5c2bdc28bfd269) Signed-off-by: Luca Barbato <lu_zero@gentoo.org> (cherry picked from commit 10f384e4f5d0ee692cacaf90d629d8bc2178b092)
-rw-r--r--libavformat/bfi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index c0b5681744..326c1f3e83 100644
--- a/libavformat/bfi.c
+++ b/libavformat/bfi.c
@@ -130,6 +130,10 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
video_offset = avio_rl32(pb);
audio_size = video_offset - audio_offset;
bfi->video_size = chunk_size - video_offset;
+ if (audio_size < 0 || bfi->video_size < 0) {
+ av_log(s, AV_LOG_ERROR, "Invalid audio/video offsets or chunk size\n");
+ return AVERROR_INVALIDDATA;
+ }
//Tossing an audio packet at the audio decoder.
ret = av_get_packet(pb, pkt, audio_size);