[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdegraphics/kpdf/xpdf/xpdf
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2007-11-08 22:25:43
Message-ID: 1194560743.531236.25282.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 734456 by aacid:

another gmallocn -> gmallocn_checkoverflow
Fixes crashes on erroneus pdf sent by Than Ngo
CCMAIL: than@redhat.com
CCMAIL: mueller@kde.org


 M  +15 -6     Stream.cc  


--- branches/KDE/3.5/kdegraphics/kpdf/xpdf/xpdf/Stream.cc #734455:734456
@@ -1255,14 +1255,18 @@
   // ---> 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;
 
@@ -1279,11 +1283,16 @@
   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;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic