Skip to content

Commit 118ff03

Browse files
committed
Fix bug #80523
Don't truncate the file length to unsigned int... I have no idea whether that fully fixes the problem because the process gets OOM killed before finishing, but at least the immediate parse error is gone now.
1 parent 078cdd8 commit 118ff03

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

NEWS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2021, PHP 7.4.15
44

5-
5+
- Core:
6+
. Fixed bug #80523 (bogus parse error on >4GB source code). (Nikita)
67

78
07 Jan 2021, PHP 7.4.14
89

Zend/zend_language_scanner.l

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static void yy_pop_state(void)
177177
zend_stack_del_top(&SCNG(state_stack));
178178
}
179179

180-
static void yy_scan_buffer(char *str, unsigned int len)
180+
static void yy_scan_buffer(char *str, size_t len)
181181
{
182182
YYCURSOR = (YYCTYPE*)str;
183183
YYLIMIT = YYCURSOR + len;
@@ -554,7 +554,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle)
554554
}
555555
}
556556
SCNG(yy_start) = (unsigned char *)buf;
557-
yy_scan_buffer(buf, (unsigned int)size);
557+
yy_scan_buffer(buf, size);
558558
} else {
559559
zend_error_noreturn(E_COMPILE_ERROR, "zend_stream_mmap() failed");
560560
}
@@ -722,7 +722,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename)
722722
}
723723
}
724724

725-
yy_scan_buffer(buf, (unsigned int)size);
725+
yy_scan_buffer(buf, size);
726726

727727
new_compiled_filename = zend_string_init(filename, strlen(filename), 0);
728728
zend_set_compiled_filename(new_compiled_filename);

0 commit comments

Comments
 (0)