From 7cd4d089bea1eec6b95a52f18dbee429dc06d4ed Mon Sep 17 00:00:00 2001 From: rtognimp Date: Tue, 14 Sep 2004 21:02:19 +0000 Subject: [PATCH] Index must be positive to prevent endless loop on bad data Based on an idea by iive git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13337 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mp3lib/layer2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mp3lib/layer2.c b/mp3lib/layer2.c index 8c1073943c..759d57521a 100644 --- a/mp3lib/layer2.c +++ b/mp3lib/layer2.c @@ -80,12 +80,12 @@ static void II_step_one(unsigned int *bit_alloc,int *scale,struct frame *fr) bita = bit_alloc; if(stereo) { - for (i=jsbound;i;i--,alloc1+=(1<0;i--,alloc1+=(1<bits); *bita++ = (char) getbits(step); } - for (i=sblimit-jsbound;i;i--,alloc1+=(1<0;i--,alloc1+=(1<bits); bita[1] = bita[0]; @@ -93,24 +93,24 @@ static void II_step_one(unsigned int *bit_alloc,int *scale,struct frame *fr) } 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<0;i--,alloc1+=(1<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++) {