[Mplayer-cvslog] CVS: main/mp3lib layer2.c,1.5,1.6

Roberto Togni CVS syncmail at mplayerhq.hu
Tue Sep 14 23:02:22 CEST 2004


CVS change done by Roberto Togni CVS

Update of /cvsroot/mplayer/main/mp3lib
In directory mail:/var2/tmp/cvs-serv12784

Modified Files:
	layer2.c 
Log Message:
Index must be positive to prevent endless loop on bad data
Based on an idea by iive


Index: layer2.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp3lib/layer2.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- layer2.c	6 Apr 2004 01:06:21 -0000	1.5
+++ layer2.c	14 Sep 2004 21:02:19 -0000	1.6
@@ -80,12 +80,12 @@
     bita = bit_alloc;
     if(stereo)
     {
-      for (i=jsbound;i;i--,alloc1+=(1<<step))
+      for (i=jsbound;i>0;i--,alloc1+=(1<<step))
       {
         *bita++ = (char) getbits(step=alloc1->bits);
         *bita++ = (char) getbits(step);
       }
-      for (i=sblimit-jsbound;i;i--,alloc1+=(1<<step))
+      for (i=sblimit-jsbound;i>0;i--,alloc1+=(1<<step))
       {
         bita[0] = (char) getbits(step=alloc1->bits);
         bita[1] = bita[0];
@@ -93,24 +93,24 @@
       }
       bita = bit_alloc;
       scfsi=scfsi_buf;
-      for (i=sblimit2;i;i--)
+      for (i=sblimit2;i>0;i--)
         if (*bita++)
           *scfsi++ = (char) getbits_fast(2);
     }
     else /* mono */
     {
-      for (i=sblimit;i;i--,alloc1+=(1<<step))
+      for (i=sblimit;i>0;i--,alloc1+=(1<<step))
         *bita++ = (char) getbits(step=alloc1->bits);
       bita = bit_alloc;
       scfsi=scfsi_buf;
-      for (i=sblimit;i;i--)
+      for (i=sblimit;i>0;i--)
         if (*bita++)
           *scfsi++ = (char) getbits_fast(2);
     }
 
     bita = bit_alloc;
     scfsi=scfsi_buf;
-    for (i=sblimit2;i;i--) 
+    for (i=sblimit2;i>0;i--) 
       if (*bita++)
         switch (*scfsi++) 
         {




More information about the MPlayer-cvslog mailing list