com php-src: Fix yy_limit computation after encoding switch: Zend/zend_language_scanner.c Zend/zend_la nguage_scanner.l
ext/mbstring/tests/zend_multibyte-0 7.phpt ext/mbstring/tests/zend_multibyte-09.phpt
| From: | Nikita Popov | Date: | Thu, 11 Sep 2014 12:52:59 +0000 |
| Subject: | com php-src: Fix yy_limit computation after encoding switch: Zend/zend_language_scanner.c Zend/zend_la nguage_scanner.l ext/mbstring/tests/zend_multibyte-0 7.phpt ext/mbstring/tests/zend_multibyte-09.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81506@lists.php.net to get a copy of this message | ||
Commit: e2d4d700cffe4cc7dcd2f486a77e0465ff937a3e
Author: Nikita Popov <nikic@php.net> Thu, 11 Sep 2014 14:51:02 +0200
Parents: f017843df37028aab161e42368aaa1caaa548322
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e2d4d700cffe4cc7dcd2f486a77e0465ff937a3e
Log:
Fix yy_limit computation after encoding switch
The three assignments above this line are still broken - they assume
that byte offsets in one encoding directly map to byte offsets in
another encoding.
I'm fixing the length here because it is the one causing out-of-bounds
reads and is easy to fix. For the others we'd have to actually compute
new offsets.
Changed paths:
M Zend/zend_language_scanner.c
M Zend/zend_language_scanner.l
M ext/mbstring/tests/zend_multibyte-07.phpt
M ext/mbstring/tests/zend_multibyte-09.phpt
Diff:
diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c
index e524e0b..5bd2798 100644
--- a/Zend/zend_language_scanner.c
+++ b/Zend/zend_language_scanner.c
@@ -845,7 +845,7 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
SCNG(yy_cursor) = new_yy_start + (SCNG(yy_cursor) - SCNG(yy_start));
SCNG(yy_marker) = new_yy_start + (SCNG(yy_marker) - SCNG(yy_start));
SCNG(yy_text) = new_yy_start + (SCNG(yy_text) - SCNG(yy_start));
- SCNG(yy_limit) = new_yy_start + (SCNG(yy_limit) - SCNG(yy_start));
+ SCNG(yy_limit) = new_yy_start + length;
SCNG(yy_start) = new_yy_start;
}
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index 146e354..bcc341e 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -843,7 +843,7 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
SCNG(yy_cursor) = new_yy_start + (SCNG(yy_cursor) - SCNG(yy_start));
SCNG(yy_marker) = new_yy_start + (SCNG(yy_marker) - SCNG(yy_start));
SCNG(yy_text) = new_yy_start + (SCNG(yy_text) - SCNG(yy_start));
- SCNG(yy_limit) = new_yy_start + (SCNG(yy_limit) - SCNG(yy_start));
+ SCNG(yy_limit) = new_yy_start + length;
SCNG(yy_start) = new_yy_start;
}
diff --git a/ext/mbstring/tests/zend_multibyte-07.phpt b/ext/mbstring/tests/zend_multibyte-07.phpt
index 50d4cd9..685c6f1 100644
--- a/ext/mbstring/tests/zend_multibyte-07.phpt
+++ b/ext/mbstring/tests/zend_multibyte-07.phpt
@@ -1,8 +1,5 @@
--TEST--
zend multibyte (7)
---SKIPIF--
---XFAIL--
-https://bugs.php.net/bug.php?id=66582
--INI--
error_reporting=E_ALL & ~E_DEPRECATED
zend.multibyte=On
diff --git a/ext/mbstring/tests/zend_multibyte-09.phpt b/ext/mbstring/tests/zend_multibyte-09.phpt
index 7b0015c..f9b8bf7 100644
--- a/ext/mbstring/tests/zend_multibyte-09.phpt
+++ b/ext/mbstring/tests/zend_multibyte-09.phpt
@@ -1,8 +1,5 @@
--TEST--
zend multibyte (9)
---SKIPIF--
---XFAIL--
-https://bugs.php.net/bug.php?id=66582
--INI--
error_reporting=E_ALL & ~E_DEPRECATED
zend.multibyte=On