avformat/mov: fix integer overflow in mov_read_udta_string()

Found-by: Paul Mehta <paul@paulmehta.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3859868c75)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2015-01-06 04:29:10 +01:00
parent 9143ab0e5a
commit 25312a427b

View File

@@ -355,7 +355,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (!key) if (!key)
return 0; return 0;
if (atom.size < 0) if (atom.size < 0 || str_size >= INT_MAX/2)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
str_size_alloc = str_size << 1; // worst-case requirement for output string in case of utf8 coded input str_size_alloc = str_size << 1; // worst-case requirement for output string in case of utf8 coded input