]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
maybe fix the stupid bug in the mp3 decoder code
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 17 May 2007 16:33:45 +0000 (16:33 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 17 May 2007 16:33:45 +0000 (16:33 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5198 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/formats/mod_shout/layer3.c

index ec8eeda77aa3b0f56f02f58cf55101e6ccdefd3d..490178df2c3968f64df5dadbf0fca750c6a5b17e 100644 (file)
@@ -826,9 +826,23 @@ static int III_dequantize_sample(struct mpstr *mp, real xr[SBLIMIT][SSLIMIT], in
                                int x, y;
 
                                if (!mc) {
+                                       unsigned sanity;
                                        mc = *m++;
-                                       v = gr_info->pow2gain[((*scf++) + (*pretab++)) << shift];
-                                       cb = *m++;
+                                       if ((unsigned)*scf < 100 && (unsigned)*pretab < 100) {
+                                               sanity = (((*scf++) + (*pretab++)) << shift);
+                                       
+                                               //v = gr_info->pow2gain[((*scf++) + (*pretab++)) << shift];
+                                               if (sanity < 100) {
+                                                       v = gr_info->pow2gain[sanity];
+                                                       cb = *m++;
+                                               } else {
+                                                       return 1;
+                                               }
+
+                                       } else {
+                                               return 1;
+                                       }
+
                                }
                                {
                                        register short *val = h->table;