Bug #73881 [NEW]: A code that makes segmentation fault
| From: | eruiz at dataclick dot es | Date: | Fri, 06 Jan 2017 13:29:00 +0000 |
| Subject: | Bug #73881 [NEW]: A code that makes segmentation fault | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-206315@lists.php.net to get a copy of this message | ||
From: eruiz at dataclick dot es
Operating system: Linux Gentoo
PHP version: 7.1.0
Package: *General Issues
Bug Type: Bug
Bug description:A code that makes segmentation fault
Description:
------------
Hello,
I notice you about this bug that causes that PHP fails and 'Segmentation
Fault' and so you can see "Error Gateway" in browser!!
Only happens with new released version PHP 7.1.0 and without execution
code! just reading the file fpdf.php that I use to generate PDF files
(http://www.fpdf.org) and in function "Image" in main class:
This code in the file and "without execution" causes segmentation fault
when PHP only read the file:
if($w<0)
$w = -$info['w']*72/$w/$this->k;
if($h<0)
$h = -$info['h']*72/$h/$this->k;
To solve it... I have changed avoiding /$w and /$h because it's seem
that PHP consider value as 0 or whatever
if($w<0)
$w = -$info['w']*72/min($w,1)/$this->k;
if($h<0)
$h = -$info['h']*72/min($h,1)/$this->k;
Thanks and happy new year from Spain ;)
Eduardo Ruiz
Test script:
---------------
// Just create a file with these lines and without execution and read
it:
if($w<0)
$w = -$info['w']*72/$w/$this->k;
if($h<0)
$h = -$info['h']*72/$h/$this->k;
Expected result:
----------------
No segmentation fault!!!
Actual result:
--------------
Segmentation Fault and Gateway error
--
Edit bug report at https://bugs.php.net/bug.php?id=73881&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73881&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73881&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73881&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73881&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73881&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73881&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73881&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73881&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73881&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73881&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73881&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73881&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73881&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73881&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73881&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73881&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73881&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73881&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73881&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73881&r=mysqlcfg