Bug #81167 [NEW]: Segfault when loading a large file
| From: | kochnorman at rocketmail dot com | Date: | Fri, 18 Jun 2021 09:18:28 +0000 |
| Subject: | Bug #81167 [NEW]: Segfault when loading a large file | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-234477@lists.php.net to get a copy of this message | ||
From: kochnorman at rocketmail dot com
Operating system: Debian 10
PHP version: 7.3Git-2021-06-18 (Git)
Package: Compile Failure
Bug Type: Bug
Bug description:Segfault when loading a large file
Description:
------------
Sorry first, I use PHP 7.3.19-1~deb10u1, but I could not choose this
version.
I encountered problems with a very larges script I have. The minimal
(not-)working example I could create can be created and tested with
perl -e 'sub rstr { my $len = shift; return join("", map {
(a..z,A..Z,0..9)[rand 67] } 0..$len) }; print "<?php\n"; my $subname =
"a"; foreach (1 .. 1000) { print qq#function test_$subname () { return
"#.rstr(100).qq#"; }\n#; $subname++; }' > test.php; php -l test.php
The file compiles, but then crashes with
[1] 32247 segmentation fault php -l test.php
I believe a 1000-line-file should not cause this error.
Trying to reduce the length of the file, I even get another message:
perl -e 'sub rstr { my $len = shift; return join("", map {
(a..z,A..Z,0..9)[rand 67] } 0..$len) }; print "<?php\n"; my $subname =
"a"; foreach (1 .. 1000) { print qq#function test_$subname () { return
"#.rstr(100).qq#"; }\n#; $subname++; }' > test.php; php -l test.php
No syntax errors detected in test.php
zend_mm_heap corrupted
I have no idea why this happens.
I can work around this problem by splitting a large file into several
smaller ones and then including the smaller files.
Test script:
---------------
Segfault:
perl -e 'sub rstr { my $len = shift; return join("", map {
(a..z,A..Z,0..9)[rand 67] } 0..$len) }; print "<?php\n"; my $subname =
"a"; foreach (1 .. 1000) { print qq#function test_$subname () { return
"#.rstr(100).qq#"; }\n#; $subname++; }' > test.php; php -l test.php
zend_mm_heap corrupted:
perl -e 'sub rstr { my $len = shift; return join("", map {
(a..z,A..Z,0..9)[rand 67] } 0..$len) }; print "<?php\n"; my $subname =
"a"; foreach (1 .. 1000) { print qq#function test_$subname () { return
"#.rstr(100).qq#"; }\n#; $subname++; }' > test.php; php -l test.php
--
Edit bug report at https://bugs.php.net/bug.php?id=81167&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81167&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81167&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81167&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81167&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81167&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81167&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81167&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81167&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81167&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81167&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81167&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81167&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81167&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81167&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81167&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81167&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81167&r=mysqlcfg