File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -373,7 +373,6 @@ private function readMpegFrame($fp) {
373373
374374 switch ($ header_bytes [1 ] >> 3 & 0b11 ) {
375375 case 0b00 : $ this ->codecVersion = self ::MPEG_25 ; break ;
376- case 0b01 : $ this ->codecVersion = self ::CODEC_UNDEFINED ; break ;
377376 case 0b10 : $ this ->codecVersion = self ::MPEG_2 ; break ;
378377 case 0b11 : $ this ->codecVersion = self ::MPEG_1 ; break ;
379378 }
@@ -384,6 +383,9 @@ private function readMpegFrame($fp) {
384383 case 0b11 : $ this ->layerVersion = self ::LAYER_1 ; break ;
385384 }
386385
386+ if (!isset ($ this ->codecVersion ) || !isset ($ this ->layerVersion ) || !isset ($ header_bytes [2 ])) {
387+ throw new \Exception ('Unrecognized codecVersion or layerVersion headers! ' );
388+ }
387389 $ this ->bitRate = self ::$ _bitRateTable [$ this ->codecVersion ][$ this ->layerVersion ][$ header_bytes [2 ] >> 4 ];
388390 $ this ->sampleRate = self ::$ _sampleRateTable [$ this ->codecVersion ][($ header_bytes [2 ] >> 2 ) & 0b11 ];
389391
@@ -394,6 +396,9 @@ private function readMpegFrame($fp) {
394396 case 0b11 : $ this ->channel = self ::MONO ; break ;
395397 }
396398
399+ if (!isset ($ this ->channel )) {
400+ throw new \Exception ('Unrecognized channel header! ' );
401+ }
397402 $ vbr_offset = self ::$ _vbrOffsets [$ this ->codecVersion ][$ this ->channel == self ::MONO ? 0 : 1 ];
398403
399404 // check for VBR
You can’t perform that action at this time.
0 commit comments