summaryrefslogtreecommitdiff
blob: 5664cf024b22040595540e9ba95e2044c2c198d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 61b1916c3e87c3b8f4fc3d1f1d19bf427b9247da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Tue, 30 Apr 2019 03:51:14 +0200
Subject: [TagLibExtractor] Fix crash on invalid Speex files

Summary:
TagLib::Ogg::Speex::File::isValid() returns true even for invalid files,
but tag() only returns a valid XiphComment when the file is valid.

Other TagLib::Ogg::* classes properly clear the valid flag when
encountering files.

See https://github.com/taglib/taglib/issues/902

BUG: 403902

Reviewers: #baloo, #frameworks, ngraham, astippich

Reviewed By: #baloo, ngraham, astippich

Subscribers: kde-frameworks-devel

Tags: #frameworks, #baloo

Differential Revision: https://phabricator.kde.org/D20913
---
 src/extractors/taglibextractor.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/extractors/taglibextractor.cpp b/src/extractors/taglibextractor.cpp
index 1954cac..e355907 100644
--- a/src/extractors/taglibextractor.cpp
+++ b/src/extractors/taglibextractor.cpp
@@ -476,7 +476,9 @@ void TagLibExtractor::extract(ExtractionResult* result)
         }
     } else if (mimeType == QLatin1String("audio/speex") || mimeType == QLatin1String("audio/x-speex+ogg")) {
         TagLib::Ogg::Speex::File file(&stream, true);
-        if (file.isValid()) {
+        // Workaround for buggy taglib:
+        // isValid() returns true for invalid files, but XiphComment* tag() returns a nullptr
+        if (file.isValid() && file.tag()) {
             extractAudioProperties(&file, result);
             readGenericProperties(file.properties(), result);
         }
-- 
cgit v1.1