OSDN Git Service

Make buffer size check consistent and avoid a possible overflow.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Wed, 15 Jun 2011 18:21:33 +0000 (20:21 +0200)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Wed, 15 Jun 2011 18:21:33 +0000 (20:21 +0200)
libavformat/rtpenc_h264.c

index 0f8850e..11074d0 100644 (file)
@@ -40,7 +40,7 @@ static const uint8_t *avc_mp4_find_startcode(const uint8_t *start, const uint8_t
         res = (res << 8) | *start++;
     }
 
-    if (res + start > end) {
+    if (end - start < res) {
         return NULL;
     }