]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/psxstr.c
Check sub_packet_size against 0 to avoid div by zero later.
[ffmpeg] / libavformat / psxstr.c
index f090cd43498c6ab323ec65b18ffde62fcd108174..469a2c40c546d6f36d156e888c19bbe7ec68eda1 100644 (file)
@@ -66,8 +66,7 @@ static const char sync_header[12] = {0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf
 
 static int str_probe(AVProbeData *p)
 {
-    int start;
-    uint8_t *sector;
+    uint8_t *sector= p->buf;
 
     if (p->buf_size < RAW_CD_SECTOR_SIZE)
         return 0;
@@ -76,14 +75,11 @@ static int str_probe(AVProbeData *p)
         (AV_RL32(&p->buf[8]) == CDXA_TAG)) {
 
         /* RIFF header seen; skip 0x2C bytes */
-        start = RIFF_HEADER_SIZE;
-    } else
-        start = 0;
-
-    sector= p->buf + start;
+        sector += RIFF_HEADER_SIZE;
+    }
 
     /* look for CD sync header (00, 0xFF x 10, 00) */
-    if (memcmp(p->buf+start,sync_header,sizeof(sync_header)))
+    if (memcmp(sector,sync_header,sizeof(sync_header)))
         return 0;
 
     if(sector[0x11] >= 32)