summaryrefslogtreecommitdiff
path: root/libavformat/wtvdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-20 14:51:02 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-20 14:51:02 +0200
commit6c18775bae785353dbe25508cab127629f9910a7 (patch)
tree5d9613d1465d97804635c116ed5f2759e6246cb6 /libavformat/wtvdec.c
parent09b09ef4ab5c20feb815cb6ef7a297b8c046f44e (diff)
parent83c285f88016b087c2f0f4b9ef356ad8ef12d947 (diff)
Merge commit '83c285f88016b087c2f0f4b9ef356ad8ef12d947'
* commit '83c285f88016b087c2f0f4b9ef356ad8ef12d947': wtv: Add more sanity checks for a length read from the file Conflicts: libavformat/wtv.c See: c42efad3c34cace09555e05fd0cb81cb59cc726f Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/wtvdec.c')
-rw-r--r--libavformat/wtvdec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index 551242d8a1..ab51171349 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -261,7 +261,12 @@ static AVIOContext * wtvfile_open2(AVFormatContext *s, const uint8_t *buf, int b
dir_length = AV_RL16(buf + 16);
file_length = AV_RL64(buf + 24);
name_size = 2 * AV_RL32(buf + 32);
- if (buf + 48 + (int64_t)name_size > buf_end || name_size<0) {
+ if (name_size < 0) {
+ av_log(s, AV_LOG_ERROR,
+ "bad filename length, remaining directory entries ignored\n");
+ break;
+ }
+ if (48 + (int64_t)name_size > buf_end - buf) {
av_log(s, AV_LOG_ERROR, "filename exceeds buffer size; remaining directory entries ignored\n");
break;
}