diff mbox

[FFmpeg-devel,v3] avformat/utils: Fixes misdetection of zYLx.wav

Message ID 20191107113419.24404-1-lance.lmwang@gmail.com
State New
Headers show

Commit Message

Lance Wang Nov. 7, 2019, 11:34 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/mp3dec.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox

Patch

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 258f19174b..f15045dd6f 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -73,6 +73,7 @@  static int mp3_read_probe(const AVProbeData *p)
     int frames, ret;
     int framesizes, max_framesizes;
     uint32_t header;
+    uint32_t next;
     const uint8_t *buf, *buf0, *buf2, *end;
 
     buf0 = p->buf;
@@ -93,6 +94,10 @@  static int mp3_read_probe(const AVProbeData *p)
             ret = avpriv_mpegaudio_decode_header(&h, header);
             if (ret != 0)
                 break;
+            next = AV_RB32(buf2 + 4);
+            /* detect invalid data after header */
+            if ((header & 0xfffe0000) == (next & 0xfffe0000))
+                break;
             buf2 += h.frame_size;
             framesizes += h.frame_size;
         }