Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > 6709f41e1c9c0ac6e610e609c299d4fb > files > 1

libxml2-2.6.26-2.1.12.el5_7.2.src.rpm

--- tree.c.orig	2006-05-31 15:12:45.000000000 +0200
+++ tree.c	2008-11-12 15:58:48.000000000 +0100
@@ -14,7 +14,7 @@
 #include "libxml.h"
 
 #include <string.h> /* for memset() only ! */
-
+#include <limits.h>
 #ifdef HAVE_CTYPE_H
 #include <ctype.h>
 #endif
@@ -6816,7 +6816,13 @@ xmlBufferResize(xmlBufferPtr buf, unsign
     case XML_BUFFER_ALLOC_DOUBLEIT:
 	/*take care of empty case*/
         newSize = (buf->size ? buf->size*2 : size + 10);
-        while (size > newSize) newSize *= 2;
+        while (size > newSize) {
+            if (newSize > UINT_MAX / 2) {
+                xmlTreeErrMemory("growing buffer");
+                return 0;
+            }
+            newSize *= 2;
+        }
         break;
     case XML_BUFFER_ALLOC_EXACT:
         newSize = size+10;