com php-src: Overflow check: ext/opcache/zend_accelerator_m odule.c
| From: | Dmitry Stogov | Date: | Thu, 17 Nov 2016 10:17:34 +0000 |
| Subject: | com php-src: Overflow check: ext/opcache/zend_accelerator_m odule.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95824@lists.php.net to get a copy of this message | ||
Commit: d4b3f89c53f8812cbaede013d7e4000917cf27e1
Author: Dmitry Stogov <dmitry@zend.com> Thu, 17 Nov 2016 13:17:34 +0300
Parents: 5e001c34ec88c9a1625f9874cdf27f82912014e2
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d4b3f89c53f8812cbaede013d7e4000917cf27e1
Log:
Overflow check
Changed paths:
M ext/opcache/zend_accelerator_module.c
Diff:
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index a7cf5c3..481660c 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -107,6 +107,8 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption)
#else
char *base = (char *) ts_resource(*((int *) mh_arg2));
#endif
+ zend_long overflow;
+ double dummy;
/* keep the compiler happy */
(void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
@@ -130,7 +132,10 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption)
ini_entry->value = zend_string_init(new_new_value, 1, 1);
}
- *p = memsize * (1024 * 1024);
+ ZEND_SIGNED_MULTIPLY_LONG(memsize, 1024 * 1024, *p, dummy, overflow);
+ if (UNEXPECTED(overflow)) {
+ *p = ZEND_ULONG_MAX;
+ }
return SUCCESS;
}