shithub: mp3dec

Download patch

ref: 56654e9d03aea75c4857e1e0a67dc3cdbce0ed1c
parent: aa2801e1128d3d69ed805483e0369ab18ad556b3
author: lieff <lieff@users.noreply.github.com>
date: Sun Feb 11 14:21:33 EST 2018

suppress big float->int ub on invalid data found by afl

--- a/minimp3.h
+++ b/minimp3.h
@@ -1396,6 +1396,10 @@
 
 static short mp3d_scale_pcm(float sample)
 {
+#ifdef FUZZ
+    if (sample >  32767.0) return (short) 32767;
+    if (sample < -32768.0) return (short)-32768;
+#endif
     int s = (int)(sample + .5f);
     s -= (s < 0);   /* away from zero, to be compliant */
     if (s >  32767) return (short) 32767;