aboutsummaryrefslogtreecommitdiffstats
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 19:22:07 +0200
commit5aac0811100ee5db9d03d7488b69cc321854da70 (patch)
tree872f8ce0758982ab38e623af6a11324830a86282
parentd8745de6ae6c6272fb33f696842cedae2c3eaad1 (diff)
downloadffmpeg-5aac0811100ee5db9d03d7488b69cc321854da70.tar.gz
id3v2: check for end of file while unescaping tags
Prevent an out of buffer bound write. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org (cherry picked from commit af4cc2605c7a56ecfd84c264aa2b325020418472) Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r--libavformat/id3v2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 7f39a47428..5cc17c4f3e 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -626,9 +626,10 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
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);
}