-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(mp3info): apply upstream patch for invalid array access
Patch: wapmorgan/Mp3Info#36 Signed-off-by: Daniel Kesselberg <[email protected]>
- Loading branch information
Showing
6 changed files
with
64 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
diff --git a/src/Mp3Info.php b/src/Mp3Info.php | ||
index 257b147..17e4074 100644 | ||
--- a/src/Mp3Info.php | ||
+++ b/src/Mp3Info.php | ||
@@ -373,7 +373,6 @@ private function readMpegFrame($fp) { | ||
|
||
switch ($header_bytes[1] >> 3 & 0b11) { | ||
case 0b00: $this->codecVersion = self::MPEG_25; break; | ||
- case 0b01: $this->codecVersion = self::CODEC_UNDEFINED; break; | ||
case 0b10: $this->codecVersion = self::MPEG_2; break; | ||
case 0b11: $this->codecVersion = self::MPEG_1; break; | ||
} | ||
@@ -384,6 +383,9 @@ private function readMpegFrame($fp) { | ||
case 0b11: $this->layerVersion = self::LAYER_1; break; | ||
} | ||
|
||
+ if (!isset($this->codecVersion) || !isset($this->layerVersion) || !isset($header_bytes[2])) { | ||
+ throw new \Exception('Unrecognized codecVersion or layerVersion headers!'); | ||
+ } | ||
$this->bitRate = self::$_bitRateTable[$this->codecVersion][$this->layerVersion][$header_bytes[2] >> 4]; | ||
$this->sampleRate = self::$_sampleRateTable[$this->codecVersion][($header_bytes[2] >> 2) & 0b11]; | ||
|
||
@@ -394,6 +396,9 @@ private function readMpegFrame($fp) { | ||
case 0b11: $this->channel = self::MONO; break; | ||
} | ||
|
||
+ if (!isset($this->channel)) { | ||
+ throw new \Exception('Unrecognized channel header!'); | ||
+ } | ||
$vbr_offset = self::$_vbrOffsets[$this->codecVersion][$this->channel == self::MONO ? 0 : 1]; | ||
|
||
// check for VBR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
{ | ||
"patches": { | ||
"sabre/dav": { | ||
"Fix getNodeForPath cache": ".patches/fix-cache-for-node.diff" | ||
} | ||
|
||
} | ||
"patches": { | ||
"sabre/dav": { | ||
"Fix getNodeForPath cache": ".patches/fix-cache-for-node.diff" | ||
}, | ||
"wapmorgan/mp3info": { | ||
"generate exception if codec/layer versions or channel headers are unrecognized": ".patches/mp3info-check-array-key.diff" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches) | ||
Patches applied to this directory: | ||
|
||
generate exception if codec/layer versions or channel headers are unrecognized | ||
Source: .patches/mp3info-check-array-key.diff | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters