diff --git a/libavformat/mov.c b/libavformat/mov.c index 03fd90e3d3..afef53b79a 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -162,7 +162,11 @@ static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len, for (i = 0; i < len; i++) { uint8_t t, c = avio_r8(pb); - if (c < 0x80 && p < end) + + if (p >= end) + continue; + + if (c < 0x80) *p++ = c; else if (p < end) PUT_UTF8(mac_to_unicode[c-0x80], t, if (p < end) *p++ = t;);