summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel <mail@danielkesselberg.de>2023-06-01 20:37:32 +0200
committerGitHub <noreply@github.com>2023-06-01 20:37:32 +0200
commita2ac818bd26d72bf165fd8000f473467f9278ef3 (patch)
treee67adfdeefab31d2c3ff56c9173276ee8d22129b /lib
parent5b02df2f86b074c634e88463f48cbb5560094868 (diff)
parentef0cffc93760d300f4e05f8a4937f1460fd741ac (diff)
downloadnextcloud-server-a2ac818bd26d72bf165fd8000f473467f9278ef3.tar.gz
nextcloud-server-a2ac818bd26d72bf165fd8000f473467f9278ef3.zip
Merge pull request #38517 from nextcloud/backport/38496/stable26
[stable26] fix: catch errors in id3parser library
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Preview/MP3.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/private/Preview/MP3.php b/lib/private/Preview/MP3.php
index 47d752af477..ff6ff86c966 100644
--- a/lib/private/Preview/MP3.php
+++ b/lib/private/Preview/MP3.php
@@ -32,6 +32,7 @@ use ID3Parser\ID3Parser;
use OCP\Files\File;
use OCP\IImage;
+use Psr\Log\LoggerInterface;
class MP3 extends ProviderV2 {
/**
@@ -48,8 +49,18 @@ class MP3 extends ProviderV2 {
$getID3 = new ID3Parser();
$tmpPath = $this->getLocalFile($file);
- $tags = $getID3->analyze($tmpPath);
- $this->cleanTmpFiles();
+ try {
+ $tags = $getID3->analyze($tmpPath);
+ } catch (\Throwable $e) {
+ \OC::$server->get(LoggerInterface::class)->info($e->getMessage(), [
+ 'exception' => $e,
+ 'app' => 'core',
+ ]);
+ return null;
+ } finally {
+ $this->cleanTmpFiles();
+ }
+
$picture = isset($tags['id3v2']['APIC'][0]['data']) ? $tags['id3v2']['APIC'][0]['data'] : null;
if (is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) {
$picture = $tags['id3v2']['PIC'][0]['data'];