php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73881 A code that makes segmentation fault
Submitted: 2017-01-06 13:28 UTC Modified: 2017-01-06 15:17 UTC
From: eruiz at dataclick dot es Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 7.1.0 OS: Linux Gentoo
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: eruiz at dataclick dot es
New email:
PHP Version: OS:

 

 [2017-01-06 13:28 UTC] eruiz at dataclick dot es
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

Patches

PHP_error_with_multiple_divisions (last revision 2017-01-06 13:31 UTC by eruiz at dataclick dot es)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-06 15:17 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 [2017-01-06 15:17 UTC] nikic@php.net
Duplicate of bug #73668, which will be fixed in 7.1.1.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC