com php-src: Fix bug #67252: convert_uudecode out-of-bounds read: NEWS ext/standard/tests/strings/bug6725 2.phpt ext/standard/uuencode.c

From: Date: Mon, 12 May 2014 03:29:27 +0000
Subject: com php-src: Fix bug #67252: convert_uudecode out-of-bounds read: NEWS ext/standard/tests/strings/bug6725 2.phpt ext/standard/uuencode.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-78322@lists.php.net to get a copy of this message
Commit: 1e2818b143760a79a0887861bd6221b158355073 Author: Stanislav Malyshev <stas@php.net> Sun, 11 May 2014 20:29:27 -0700 Parents: 2b475eebbea85779989e98e87753d6b023a1d131 Branches: PHP-5.4 PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1e2818b143760a79a0887861bd6221b158355073 Log: Fix bug #67252: convert_uudecode out-of-bounds read Bugs: https://bugs.php.net/67252 Changed paths: M NEWS A ext/standard/tests/strings/bug67252.phpt M ext/standard/uuencode.c Diff: diff --git a/NEWS b/NEWS index 03f8b87..69e3b8d 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ PHP NEWS . Fixed bug #67245 (usage of memcpy() with overlapping src and dst in zend_exceptions.c). (Bob) . Fixed bug #67247 (spl_fixedarray_resize integer overflow). (Stas) + . Fixed bug #67252 (convert_uudecode out-of-bounds read). (Stas) - Date: . Fixed bug #67118 (DateTime constructor crash with invalid data). (Anatol) diff --git a/ext/standard/tests/strings/bug67252.phpt b/ext/standard/tests/strings/bug67252.phpt new file mode 100644 index 0000000..80a6ebc --- /dev/null +++ b/ext/standard/tests/strings/bug67252.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #67252 (convert_uudecode out-of-bounds read) +--FILE-- +<?php + +$a = "M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A"."\n"."a."; +var_dump(convert_uudecode($a)); + +?> +--EXPECTF-- + +Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d +bool(false) diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c index 52e892e..8544aef 100644 --- a/ext/standard/uuencode.c +++ b/ext/standard/uuencode.c @@ -151,6 +151,9 @@ PHPAPI int php_uudecode(char *src, int src_len, char **dest) /* {{{ */ } while (s < ee) { + if(s+4 > e) { + goto err; + } *p++ = PHP_UU_DEC(*s) << 2 | PHP_UU_DEC(*(s + 1)) >> 4; *p++ = PHP_UU_DEC(*(s + 1)) << 4 | PHP_UU_DEC(*(s + 2)) >> 2; *p++ = PHP_UU_DEC(*(s + 2)) << 6 | PHP_UU_DEC(*(s + 3));

« previous php.cvs (#78322) next »