blob: bd2af863423b6fade92e52c27dbf0e0bd446e656 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
From 6bf7212c44d0131c8f8227a4a4dadc52a3afebd9 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Fri, 8 Sep 2017 18:29:42 +0200
Subject: [PATCH 1/3] Annot: Fix crash on broken files
Bug #102607
(cherry picked from commit 1316c7a41f4dd7276f404f775ebb5fef2d24ab1c)
---
poppler/Annot.cc | 42 +++++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 974b098b..27b698db 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -6982,26 +6982,30 @@ AnnotRichMedia::Configuration::Configuration(Dict *dict)
} else if (!strcmp(name, "Video")) {
type = typeVideo;
} else {
- // determine from first instance
+ // determine from first non null instance
+ type = typeFlash; // default in case all instances are null
if (instances && nInstances > 0) {
- AnnotRichMedia::Instance *instance = instances[0];
- switch (instance->getType()) {
- case AnnotRichMedia::Instance::type3D:
- type = type3D;
- break;
- case AnnotRichMedia::Instance::typeFlash:
- type = typeFlash;
- break;
- case AnnotRichMedia::Instance::typeSound:
- type = typeSound;
- break;
- case AnnotRichMedia::Instance::typeVideo:
- type = typeVideo;
- break;
- default:
- type = typeFlash;
- break;
- }
+ for (int i = 0; i < nInstances; ++i) {
+ AnnotRichMedia::Instance *instance = instances[i];
+ if (instance) {
+ switch (instance->getType()) {
+ case AnnotRichMedia::Instance::type3D:
+ type = type3D;
+ break;
+ case AnnotRichMedia::Instance::typeFlash:
+ type = typeFlash;
+ break;
+ case AnnotRichMedia::Instance::typeSound:
+ type = typeSound;
+ break;
+ case AnnotRichMedia::Instance::typeVideo:
+ type = typeVideo;
+ break;
+ }
+ // break the loop since we found the first non null instance
+ break;
+ }
+ }
}
}
}
--
2.14.1
|