[prev in list] [next in list] [prev in thread] [next in thread]
List: freedesktop-poppler
Subject: [poppler] Branch 'poppler-0.10' - poppler/Annot.cc
From: aacid () kemper ! freedesktop ! org (Albert Astals Cid)
Date: 2009-03-16 21:56:43
Message-ID: 20090316215643.48BD010096 () kemper ! freedesktop ! org
[Download RAW message or body]
poppler/Annot.cc | 54 ++++++++++++++++++++++++++++++++++++------------------
1 file changed, 36 insertions(+), 18 deletions(-)
New commits:
commit f015473f2fa5fed556be9b895d1ce1e760f92903
Author: Albert Astals Cid <aacid@kde.org>
Date: Mon Mar 16 22:54:27 2009 +0100
Fix parsing of border arrays
Fixes 19761
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 3cc13a0..fbf8b47 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -456,49 +456,67 @@ AnnotBorderArray::AnnotBorderArray(Array *array) {
Object obj1;
int arrayLength = array->getLength();
- if (arrayLength >= 3) {
+ GBool correct = gTrue;
+ if (arrayLength == 3 || arrayLength == 4) {
// implementation note 81 in Appendix H.
if (array->get(0, &obj1)->isNum())
horizontalCorner = obj1.getNum();
+ else
+ correct = gFalse;
obj1.free();
if (array->get(1, &obj1)->isNum())
verticalCorner = obj1.getNum();
+ else
+ correct = gFalse;
obj1.free();
if (array->get(2, &obj1)->isNum())
width = obj1.getNum();
+ else
+ correct = gFalse;
obj1.free();
// TODO: check not all zero ? (Line Dash Pattern Page 217 PDF 8.1)
- if (arrayLength > 3) {
- GBool correct = gTrue;
- int tempLength = array->getLength() - 3;
- double *tempDash = (double *) gmallocn (tempLength, sizeof (double));
+ if (arrayLength == 4) {
+ if (array->get(3, &obj1)->isArray()) {
+ Array *dashPattern = obj1.getArray();
+ int tempLength = dashPattern->getLength();
+ double *tempDash = (double *) gmallocn (tempLength, sizeof (double));
+
+ for(int i = 0; i < tempLength && i < DASH_LIMIT && correct; i++) {
- for(int i = 0; i < tempLength && i < DASH_LIMIT && correct; i++) {
+ if (dashPattern->get(i, &obj1)->isNum()) {
+ tempDash[i] = obj1.getNum();
- if (array->get((i + 3), &obj1)->isNum()) {
- tempDash[i] = obj1.getNum();
+ if (tempDash[i] < 0)
+ correct = gFalse;
- if (tempDash[i] < 0)
+ } else {
correct = gFalse;
+ }
+ obj1.free();
+ }
+ if (correct) {
+ dashLength = tempLength;
+ dash = tempDash;
+ style = borderDashed;
} else {
- correct = gFalse;
+ gfree (tempDash);
}
- obj1.free();
- }
-
- if (correct) {
- dashLength = tempLength;
- dash = tempDash;
- style = borderDashed;
} else {
- gfree (tempDash);
+ correct = gFalse;
}
+ obj1.free();
}
+ } else {
+ correct = gFalse;
+ }
+
+ if (!correct) {
+ width = 0;
}
}
_______________________________________________
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic