com php-src: Fix relative constant addressing in file cache: ext/opcache/zend_file_cache.c
| From: | Nikita Popov | Date: | Sun, 10 Dec 2017 21:34:50 +0000 |
| Subject: | com php-src: Fix relative constant addressing in file cache: ext/opcache/zend_file_cache.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100548@lists.php.net to get a copy of this message | ||
Commit: bf9e2692c0d01db3df698df9e0f0057fa192b165
Author: Nikita Popov <nikita.ppv@gmail.com> Sun, 10 Dec 2017 22:33:47 +0100
Parents: 2783b1c823de394894ec5592426416267386b958
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bf9e2692c0d01db3df698df9e0f0057fa192b165
Log:
Fix relative constant addressing in file cache
PASS_TWO_UNDO_CONSTANT was using the serialized op_array->literals
pointer, resulting in incorrect offsets.
Changed paths:
M ext/opcache/zend_file_cache.c
Diff:
diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c
index 2e5f3af..33c8da0 100644
--- a/ext/opcache/zend_file_cache.c
+++ b/ext/opcache/zend_file_cache.c
@@ -392,6 +392,11 @@ static void zend_file_cache_serialize_op_array(zend_op_array
*op_arra
if (!IS_SERIALIZED(op_array->opcodes)) {
zend_op *opline, *end;
+#if !ZEND_USE_ABS_CONST_ADDR
+ zval *literals = op_array->literals;
+ UNSERIALIZE_PTR(literals);
+#endif
+
SERIALIZE_PTR(op_array->opcodes);
opline = op_array->opcodes;
UNSERIALIZE_PTR(opline);
@@ -406,10 +411,10 @@ static void zend_file_cache_serialize_op_array(zend_op_array
*op_arra
}
#else
if (opline->op1_type == IS_CONST) {
- ZEND_PASS_TWO_UNDO_CONSTANT(op_array, opline, opline->op1);
+ opline->op1.constant = RT_CONSTANT(opline, opline->op1) - literals;
}
if (opline->op2_type == IS_CONST) {
- ZEND_PASS_TWO_UNDO_CONSTANT(op_array, opline, opline->op2);
+ opline->op2.constant = RT_CONSTANT(opline, opline->op2) - literals;
}
#endif
#if ZEND_USE_ABS_JMP_ADDR