diff --git a/libavformat/mov.c b/libavformat/mov.c index 939296a226..8bfe974d31 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -379,7 +379,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) return AVERROR_INVALIDDATA; // worst-case requirement for output string in case of utf8 coded input - str_size_alloc = raw ? str_size + 1 : str_size * 2; + str_size_alloc = (raw ? str_size : str_size * 2) + 1; str = av_malloc(str_size_alloc); if (!str) return AVERROR(ENOMEM);