Skip to content
Snippets Groups Projects
Commit 83c285f8 authored by Martin Storsjö's avatar Martin Storsjö
Browse files

wtv: Add more sanity checks for a length read from the file


Also make sure the existing length check can't overflow.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: default avatarMartin Storsjö <martin@martin.st>
parent d8b68660
No related branches found
No related tags found
No related merge requests found
...@@ -269,7 +269,12 @@ static AVIOContext * wtvfile_open2(AVFormatContext *s, const uint8_t *buf, int b ...@@ -269,7 +269,12 @@ static AVIOContext * wtvfile_open2(AVFormatContext *s, const uint8_t *buf, int b
dir_length = AV_RL16(buf + 16); dir_length = AV_RL16(buf + 16);
file_length = AV_RL64(buf + 24); file_length = AV_RL64(buf + 24);
name_size = 2 * AV_RL32(buf + 32); name_size = 2 * AV_RL32(buf + 32);
if (buf + 48 + name_size > buf_end) { if (name_size < 0) {
av_log(s, AV_LOG_ERROR,
"bad filename length, remaining directory entries ignored\n");
break;
}
if (48 + name_size > buf_end - buf) {
av_log(s, AV_LOG_ERROR, "filename exceeds buffer size; remaining directory entries ignored\n"); av_log(s, AV_LOG_ERROR, "filename exceeds buffer size; remaining directory entries ignored\n");
break; break;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment