]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mpc8: fix broken pointer math
authorwm4 <nfxjfg@googlemail.com>
Tue, 3 Feb 2015 18:04:11 +0000 (19:04 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Feb 2015 23:55:47 +0000 (00:55 +0100)
This could overflow and crash at least on 32 bit systems.

Reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mpc8.c

index 722d0ee05f6c6c7c0cc35c305b60f6500a4ebe0f..6524c7e48978f45085c0b8b918229906ced21d34 100644 (file)
@@ -91,7 +91,7 @@ static int mpc8_probe(AVProbeData *p)
         size = bs_get_v(&bs);
         if (size < 2)
             return 0;
-        if (bs + size - 2 >= bs_end)
+        if (size >= bs_end - bs + 2)
             return AVPROBE_SCORE_EXTENSION - 1; // seems to be valid MPC but no header yet
         if (header_found) {
             if (size < 11 || size > 28)