aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2013-05-01 19:01:11 +0200
committerLuca Barbato <lu_zero@gentoo.org>2013-05-03 10:21:27 +0200
commitaf4cc2605c7a56ecfd84c264aa2b325020418472 (patch)
tree80387ad0615818830b1633190485573e7c426b0c /libavformat
parent76d23f40314fc1dcd74a3d470b17782cc0ee5a3a (diff)
downloadffmpeg-af4cc2605c7a56ecfd84c264aa2b325020418472.tar.gz
id3v2: check for end of file while unescaping tags
Prevent a serious out of buffer bound write. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/id3v2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 0563e6bf85..e5f7486e1d 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -644,9 +644,10 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version,
goto seek;
}
b = buffer;
- while (avio_tell(s->pb) < end) {
+ while (avio_tell(s->pb) < end && !s->pb->eof_reached) {
*b++ = avio_r8(s->pb);
- if (*(b - 1) == 0xff && avio_tell(s->pb) < end - 1) {
+ if (*(b - 1) == 0xff && avio_tell(s->pb) < end - 1 &&
+ !s->pb->eof_reached ) {
uint8_t val = avio_r8(s->pb);
*b++ = val ? val : avio_r8(s->pb);
}