%PDF- %PDF-
Direktori : /www/varak.net/nextcloud.varak.net/3rdparty/.patches/ |
Current File : /www/varak.net/nextcloud.varak.net/3rdparty/.patches/mp3info-check-array-key.diff |
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