com php-src: fix datatype and add range check: ext/intl/uchar/uchar.c
| From: | Anatol Belski | Date: | Tue, 05 Jul 2016 08:04:23 +0000 |
| Subject: | com php-src: fix datatype and add range check: ext/intl/uchar/uchar.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92787@lists.php.net to get a copy of this message | ||
Commit: 14bdd8246c50b55d1ddf838b45de34065e8613c4
Author: Anatol Belski <ab@php.net> Tue, 5 Jul 2016 10:03:40 +0200
Parents: 11d0101516da5b4377050646a931549aa8e9023d
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=14bdd8246c50b55d1ddf838b45de34065e8613c4
Log:
fix datatype and add range check
Changed paths:
M ext/intl/uchar/uchar.c
Diff:
diff --git a/ext/intl/uchar/uchar.c b/ext/intl/uchar/uchar.c
index abb3e59..272cb22 100644
--- a/ext/intl/uchar/uchar.c
+++ b/ext/intl/uchar/uchar.c
@@ -8,10 +8,17 @@
static inline int convert_cp(UChar32* pcp, zval *zcp) {
zend_long cp = -1;
+
+ if (ZEND_SIZE_T_INT_OVFL(Z_STRLEN_P(zcp))) {
+ intl_error_set_code(NULL, U_ILLEGAL_ARGUMENT_ERROR);
+ intl_error_set_custom_msg(NULL, "Input string is too long.", 0);
+ return FAILURE;
+ }
+
if (Z_TYPE_P(zcp) == IS_LONG) {
cp = Z_LVAL_P(zcp);
} else if (Z_TYPE_P(zcp) == IS_STRING) {
- size_t i = 0;
+ int32_t i = 0;
U8_NEXT(Z_STRVAL_P(zcp), i, Z_STRLEN_P(zcp), cp);
if (i != Z_STRLEN_P(zcp)) {
intl_error_set_code(NULL, U_ILLEGAL_ARGUMENT_ERROR);