[poppler] poppler/Stream.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Thu Nov 8 14:34:21 PST 2007
poppler/Stream.cc | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
New commits:
commit 1b3f045a25e5d172357bc87c15ba591c8e1511a7
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu Nov 8 23:34:07 2007 +0100
Move another gmallocn to gmallocn_checkoverflow. Fixes crashes on incorrect pdf sent by Red Hat
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index 85d46bf..3e44e27 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -1261,14 +1261,18 @@ CCITTFaxStream::CCITTFaxStream(Stream *strA, int encodingA, GBool endOfLineA,
// ---> max codingLine size = columns + 1
// refLine has one extra guard entry at the end
// ---> max refLine size = columns + 2
- codingLine = (int *)gmallocn(columns + 1, sizeof(int));
- refLine = (int *)gmallocn(columns + 2, sizeof(int));
+ codingLine = (int *)gmallocn_checkoverflow(columns + 1, sizeof(int));
+ refLine = (int *)gmallocn_checkoverflow(columns + 2, sizeof(int));
- eof = gFalse;
+ if (codingLine != NULL && refLine != NULL) {
+ eof = gFalse;
+ codingLine[0] = columns;
+ } else {
+ eof = gTrue;
+ }
row = 0;
nextLine2D = encoding < 0;
inputBits = 0;
- codingLine[0] = columns;
a0i = 0;
outputBits = 0;
@@ -1285,11 +1289,16 @@ void CCITTFaxStream::reset() {
short code1;
str->reset();
- eof = gFalse;
+
+ if (codingLine != NULL && refLine != NULL) {
+ eof = gFalse;
+ codingLine[0] = columns;
+ } else {
+ eof = gTrue;
+ }
row = 0;
nextLine2D = encoding < 0;
inputBits = 0;
- codingLine[0] = columns;
a0i = 0;
outputBits = 0;
buf = EOF;
More information about the poppler
mailing list