summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-07-15 21:40:05 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-07-15 21:40:05 +0200
commit2c0583ae9e3e2a25551e559aa9a0864ee574137a (patch)
tree949cbf7e86afcf8db4a2c793193b5f9f9c957314 /src
parent731e8384f681769209b11a3738fea16a02501d5a (diff)
implicitely end setup section if %%Page comment is encountered
check for valid setup length after DSC parsing
Diffstat (limited to 'src')
-rw-r--r--src/PostscriptDSC.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/PostscriptDSC.cxx b/src/PostscriptDSC.cxx
index 85a9d5b..806a418 100644
--- a/src/PostscriptDSC.cxx
+++ b/src/PostscriptDSC.cxx
@@ -95,6 +95,11 @@ PostscriptDSC::parse(int fd) {
} else if (strncmp(linebuf, "%%Page: ", strlen("%%Page: ")) == 0) {
char *p_str = &linebuf[strlen(linebuf)];
+ // implicitely end setup section
+ if (!setup_len) {
+ setup_len = ftello(fp);
+ }
+
// move p_str back to beginning of last number in linebuf
while (p_str > linebuf && !isdigit(*p_str)) {
p_str--;
@@ -137,7 +142,12 @@ PostscriptDSC::parse(int fd) {
}
}
}
-
+
+ // Now do some checks
+ if (!setup_len) {
+ fprintf(stderr, "PageSetup end not found\n");
+ return 1;
+ }
if (page_len && page_off && p1 > 0 && p1 <= pages) {
page_len[p1 - 1] = ftello(fp) - page_off[p1 - 1];