shithub: mp3dec

Download patch

ref: 64a369d691ec29df12dca5e5984d208e14b2390a
parent: 3d5ff1055544ceb54ab19d68d8f08990b636edd0
author: lieff <[email protected]>
date: Wed Jan 10 20:35:57 EST 2018

range check fix

--- a/minimp3.c
+++ b/minimp3.c
@@ -1552,7 +1552,7 @@
     bs_t bs_frame[1];
     mp3dec_scratch_t scratch;
 
-    if (dec->header[0] == 0xff && hdr_compare(dec->header, mp3))
+    if (mp3_bytes > 4 && dec->header[0] == 0xff && hdr_compare(dec->header, mp3))
     {
         frame_size = hdr_frame_bytes(mp3, dec->free_format_bytes) + hdr_padding(mp3);
         if (frame_size != mp3_bytes && (frame_size + HDR_SIZE > mp3_bytes || !hdr_compare(mp3, mp3 + frame_size)))