[Mplayer-cvslog] CVS: main/libmpdemux mp3_hdr.c,1.5,1.6
Arpi of Ize
arpi at mplayerhq.hu
Fri Oct 25 16:33:53 CEST 2002
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv25821
Modified Files:
mp3_hdr.c
Log Message:
check for framesize validity, return -1 (error) for zero size (bug found by pl)
Index: mp3_hdr.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/mp3_hdr.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- mp3_hdr.c 21 Jul 2002 14:36:33 -0000 1.5
+++ mp3_hdr.c 25 Oct 2002 14:33:51 -0000 1.6
@@ -6,13 +6,13 @@
//----------------------- mp3 audio frame header parser -----------------------
static int tabsel_123[2][3][16] = {
- { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,},
- {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,},
- {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,} },
-
- { {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,},
- {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,},
- {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,} }
+ { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,0},
+ {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,0},
+ {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,0} },
+
+ { {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,0},
+ {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,0},
+ {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,0} }
};
static long freqs[9] = { 44100, 48000, 32000, 22050, 24000, 16000 , 11025 , 12000 , 8000 };
@@ -96,7 +96,13 @@
ssize = (stereo == 1) ? 17 : 32;
if(crc) ssize += 2;
- framesize = (long) tabsel_123[lsf][2][bitrate_index] * 144000;
+ framesize = tabsel_123[lsf][2][bitrate_index] * 144000;
+
+ if(!framesize){
+ mp_msg(MSGT_DEMUXER,MSGL_DBG2,"invalid framesize/bitrate_index\n");
+ return -1; // valid: 1..14
+ }
+
framesize /= freqs[sampling_frequency]<<lsf;
framesize += padding;
More information about the MPlayer-cvslog
mailing list