Browse code

Make buffer size check consistent and avoid a possible overflow.

Reimar Döffinger authored on 2011/06/16 03:21:33
Showing 1 changed files
... ...
@@ -40,7 +40,7 @@ static const uint8_t *avc_mp4_find_startcode(const uint8_t *start, const uint8_t
40 40
         res = (res << 8) | *start++;
41 41
     }
42 42
 
43
-    if (res + start > end) {
43
+    if (end - start < res) {
44 44
         return NULL;
45 45
     }
46 46