]> granicus.if.org Git - php/commitdiff
Fix #73533: Invalid memory access in php_libxml_xmlCheckUTF8 PHP-7.4
authorChristoph M. Becker <cmbecker69@gmx.de>
Tue, 23 Mar 2021 15:13:57 +0000 (16:13 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Wed, 24 Mar 2021 10:50:50 +0000 (11:50 +0100)
A string passed to `php_libxml_xmlCheckUTF8()` may be longer than
1<<31-1 bytes, so we're better using a `size_t`.

Closes GH-6802.

NEWS
ext/libxml/libxml.c

diff --git a/NEWS b/NEWS
index eef3b0302c3a9d64d61d270d752f230053adbeee..170883ec5d48b5afb1814e906875d8d6e7cfd352 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ PHP                                                                        NEWS
   . Fixed bug #80024 (Duplication of info about inherited socket after pool
     removing). (Jakub Zelenka)
 
+- LibXML:
+  . Fixed bug #73533 (Invalid memory access in php_libxml_xmlCheckUTF8). (cmb)
+
 - PDO_ODBC:
   . Fixed bug #80783 (PDO ODBC truncates BLOB records at every 256th byte).
     (cmb)
index e21d6fdbbe98cb6593ef0b423d7035cb638f7ba7..fc194770e1013849577e8815be40a1eb737f40d6 100644 (file)
@@ -1182,7 +1182,7 @@ static PHP_FUNCTION(libxml_set_external_entity_loader)
 /* {{{ Common functions shared by extensions */
 int php_libxml_xmlCheckUTF8(const unsigned char *s)
 {
-       int i;
+       size_t i;
        unsigned char c;
 
        for (i = 0; (c = s[i++]);) {