php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73780 Segfault on divide
Submitted: 2016-12-18 20:30 UTC Modified: 2017-01-01 04:22 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: gordon dot mcvey at ntlworld dot com Assigned: cmb (profile)
Status: No Feedback Package: GNU MP related
PHP Version: 7.1.0 OS: Mac OSX 10.11.6
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-12-18 20:30 UTC] gordon dot mcvey at ntlworld dot com
Description:
------------
Any attempt to divide using GMP functions triggers a segmentation fault

Test script:
---------------
$a = gmp_init ("5");
$b = gmp_init ("2");
echo gmp_add ($a, $b) . PHP_EOL;
echo gmp_sub ($a, $b) . PHP_EOL;
echo gmp_mul ($a, $b) . PHP_EOL;
echo gmp_div_q ($a, $b) . PHP_EOL;


Expected result:
----------------
7
3
10
2, 2.5 or 3


Actual result:
--------------
7
3
10
Segmentation fault: 11

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-18 20:39 UTC] gordon dot mcvey at ntlworld dot com
-Summary: Segfault on divide +Summary: gordon.mcvey@ntlworld.com
 [2016-12-18 20:39 UTC] gordon dot mcvey at ntlworld dot com
FYI, php -i gives the following data about the GMP extension: 

gmp

gmp support => enabled
GMP version => 5.1.1
 [2016-12-18 20:41 UTC] gordon dot mcvey at ntlworld dot com
-Summary: gordon.mcvey@ntlworld.com +Summary: Segfault on divide
 [2016-12-18 20:41 UTC] gordon dot mcvey at ntlworld dot com
Oops, Lastpass decided the summary field was the username field.
 [2016-12-19 09:22 UTC] gordon dot mcvey at ntlworld dot com
Does seem to work in PHP 7.0 in Ubuntu 16.04 LTS, so it's possibly an issue with the Liip PHP build for OSX
 [2016-12-19 13:31 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-12-19 13:31 UTC] cmb@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

I can't reproduce on Linux either: <https://3v4l.org/RiLpo>.
 [2017-01-01 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC