Bug #78340 [NEW]: Segfault in zend_objects_store_put

From: Date: Sun, 28 Jul 2019 11:19:51 +0000
Subject: Bug #78340 [NEW]: Segfault in zend_objects_store_put
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221954@lists.php.net to get a copy of this message
From: thekid@php.net Operating system: Linux PHP version: 7.4.0beta1 Package: Scripting Engine problem Bug Type: Bug Bug description:Segfault in zend_objects_store_put Description: ------------ When reading files from a stream wrapper, not all bytes are read. Test script: --------------- <?php class lib { public static $files= []; private $bytes, $pos; function stream_open($path, $mode, $options, $opened_path) { $this->bytes= self::$files[$path]; $this->pos= 0; $this->ino= crc32($path); return true; } function stream_read($count) { $chunk= substr($this->bytes, $this->pos, $count); $this->pos+= strlen($chunk); return $chunk; } function stream_eof() { return $this->pos >= strlen($this->bytes); } function stream_close() { $this->bytes= null; } function stream_stat() { return [ 'dev' => 3632233996, 'size' => strlen($this->bytes), 'ino' => $this->ino ]; } function stream_set_option($option, $arg1, $arg2) { return false; } } $fill= str_repeat('.', $argv[1] ?? 0); lib::$files['lib://test.php']= '<?php /* '.$fill.' */ function test() { echo "Works!\n"; }'; stream_wrapper_register('lib', lib::class); include('lib://test.php'); test(); Expected result: ---------------- $ /cygdrive/c/tools/php-7.3.6-nts-Win32-VC15-x64/php wrapper.php 8192 Works! Actual result: -------------- $ /cygdrive/c/tools/php-7.4snap-nts-windows-vc15-x64/php wrapper.php 8192 Warning: Unterminated comment starting line 1 in lib://test.php on line 1 Fatal error: Uncaught Error: Call to undefined function test() in C:\tools\cygwin\home\Timm\devel\xp\core\wrapper.php:47 Stack trace: #0 {main} -- Edit bug report at https://bugs.php.net/bug.php?id=78340&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78340&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78340&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78340&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=78340&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78340&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78340&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78340&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78340&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78340&r=support Expected behavior: https://bugs.php.net/fix.php?id=78340&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78340&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78340&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78340&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78340&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=78340&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78340&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78340&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78340&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78340&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78340&r=mysqlcfg

« previous php.bugs (#221954) next »