Skip to content

Commit caf2e47

Browse files
committed
Fix parsing of semi-reserved tokens at offset > 4GB
Related to phpGH-5668 Also affects php 8.0 but this changes the datastructures in public header files. (binary ABI change) PHP 7.4 wouldn't even parse a class with the below example. 1. Fix parsing semi-reserved tokens such as `namespace` with an offset that's larger than 2**32 2. Fix parsing some tokens when their length is larger than 2**32 Offset is relative to yy_start(the start of the file?) Low priority because 4GB php files are extremely rare ``` php > ini_set('memory_limit', '12G'); php > eval(str_repeat(' ' , 2**32) . 'class MyClass{ public static function namespace() {}}'); php > MyClass::namespace(); Warning: Uncaught Error: Call to undefined method MyClass::namespace() in php shell code:1 Stack trace: thrown in php shell code on line 1 php > var_export((new ReflectionClass('MyClass'))->getMethods()); array ( 0 => ReflectionMethod::__set_state(array( 'name' => ' ', 'class' => 'MyClass', )), ) ```
1 parent f0d6151 commit caf2e47

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Zend/zend_compile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ typedef struct _zend_file_context {
118118
} zend_file_context;
119119

120120
typedef struct {
121-
uint32_t offset;
122-
uint32_t len;
121+
size_t offset;
122+
size_t len;
123123
} zend_lexer_ident_ref;
124124

125125
typedef union _zend_parser_stack_elem {

0 commit comments

Comments
 (0)