File tree Expand file tree Collapse file tree 6 files changed +64
-13
lines changed
Expand file tree Collapse file tree 6 files changed +64
-13
lines changed Original file line number Diff line number Diff line change 1+ diff --git a/src/Mp3Info.php b/src/Mp3Info.php
2+ index 257b147..17e4074 100644
3+ --- a/src/Mp3Info.php
4+ +++ b/src/Mp3Info.php
5+ @@ -373,7 +373,6 @@ private function readMpegFrame($fp) {
6+
7+ switch ($header_bytes[1] >> 3 & 0b11) {
8+ case 0b00: $this->codecVersion = self::MPEG_25; break;
9+ - case 0b01: $this->codecVersion = self::CODEC_UNDEFINED; break;
10+ case 0b10: $this->codecVersion = self::MPEG_2; break;
11+ case 0b11: $this->codecVersion = self::MPEG_1; break;
12+ }
13+ @@ -384,6 +383,9 @@ private function readMpegFrame($fp) {
14+ case 0b11: $this->layerVersion = self::LAYER_1; break;
15+ }
16+
17+ + if (!isset($this->codecVersion) || !isset($this->layerVersion) || !isset($header_bytes[2])) {
18+ + throw new \Exception('Unrecognized codecVersion or layerVersion headers!');
19+ + }
20+ $this->bitRate = self::$_bitRateTable[$this->codecVersion][$this->layerVersion][$header_bytes[2] >> 4];
21+ $this->sampleRate = self::$_sampleRateTable[$this->codecVersion][($header_bytes[2] >> 2) & 0b11];
22+
23+ @@ -394,6 +396,9 @@ private function readMpegFrame($fp) {
24+ case 0b11: $this->channel = self::MONO; break;
25+ }
26+
27+ + if (!isset($this->channel)) {
28+ + throw new \Exception('Unrecognized channel header!');
29+ + }
30+ $vbr_offset = self::$_vbrOffsets[$this->codecVersion][$this->channel == self::MONO ? 0 : 1];
31+
32+ // check for VBR
Original file line number Diff line number Diff line change 11{
2- "patches" : {
3- "sabre/dav" : {
4- "Fix getNodeForPath cache" : " .patches/fix-cache-for-node.diff"
5- }
6-
7- }
2+ "patches" : {
3+ "sabre/dav" : {
4+ "Fix getNodeForPath cache" : " .patches/fix-cache-for-node.diff"
5+ },
6+ "wapmorgan/mp3info" : {
7+ "generate exception if codec/layer versions or channel headers are unrecognized" : " .patches/mp3info-check-array-key.diff"
8+ }
9+ }
810}
Original file line number Diff line number Diff line change 65086508 " bin/mp3scan"
65096509 ],
65106510 "type" : " library" ,
6511+ "extra" : {
6512+ "patches_applied" : {
6513+ "generate exception if codec/layer versions or channel headers are unrecognized" : " .patches/mp3info-check-array-key.diff"
6514+ }
6515+ },
65116516 "installation-source" : " dist" ,
65126517 "autoload" : {
65136518 "psr-4" : {
Original file line number Diff line number Diff line change 11<?php return array (
22 'root ' => array (
33 'name ' => 'nextcloud/3rdparty ' ,
4- 'pretty_version ' => '1.0.0+no-version-set ' ,
5- 'version ' => '1.0.0.0 ' ,
6- 'reference ' => null ,
4+ 'pretty_version ' => 'dev-master ' ,
5+ 'version ' => 'dev-master ' ,
6+ 'reference ' => ' 5d619fb1d9e9f28e5b6ceeef5fd59a85b1965e38 ' ,
77 'type ' => 'library ' ,
88 'install_path ' => __DIR__ . '/../ ' ,
99 'aliases ' => array (),
290290 'dev_requirement ' => false ,
291291 ),
292292 'nextcloud/3rdparty ' => array (
293- 'pretty_version ' => '1.0.0+no-version-set ' ,
294- 'version ' => '1.0.0.0 ' ,
295- 'reference ' => null ,
293+ 'pretty_version ' => 'dev-master ' ,
294+ 'version ' => 'dev-master ' ,
295+ 'reference ' => ' 5d619fb1d9e9f28e5b6ceeef5fd59a85b1965e38 ' ,
296296 'type ' => 'library ' ,
297297 'install_path ' => __DIR__ . '/../ ' ,
298298 'aliases ' => array (),
Original file line number Diff line number Diff line change 1+ This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches)
2+ Patches applied to this directory:
3+
4+ generate exception if codec/layer versions or channel headers are unrecognized
5+ Source: .patches/mp3info-check-array-key.diff
6+
7+
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