Bug #73668 [NEW]: "SIGFPE Arithmetic exception" in opcache when divide by minus 1

From: Date: Tue, 06 Dec 2016 12:44:56 +0000
Subject: Bug #73668 [NEW]: "SIGFPE Arithmetic exception" in opcache when divide by minus 1
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205804@lists.php.net to get a copy of this message
From:             richardh at channelgrabber dot com
Operating system: Ubuntu 14.04.1 LTS
PHP version:      7.1.0
Package:          opcache
Bug Type:         Bug
Bug description:"SIGFPE Arithmetic exception" in opcache when divide by minus 1

Description:
------------
We recently switched to PHP 7.1.0 and noticed that when
https://github.com/Setasign/FPDF/blob/master/fpdf.php
was included it
caused PHP to exit with SIGFPE.

We installed the debug symbols and ran it through GDB a few times,
reducing the issue down to lines 901 and 902
(https://github.com/Setasign/FPDF/blob/master/fpdf.php#L901).

From this we created the reduced test case attached below.

The backtrace from the error is:
#0  0x00007ffff5b069a7 in zend_inference_calc_range
(op_array=op_array@entry=0x7ffff6075008, ssa=ssa@entry=0x7ffff6097028,
var=var@entry=1, 
    widening=widening@entry=0, narrowing=narrowing@entry=1,
tmp=tmp@entry=0x7fffffffa7f0)
    at
/build/php7.1-kMIlXM/php7.1-7.1.0/ext/opcache/Optimizer/zend_inference.c:727
#1  0x00007ffff5b0c21f in zend_infer_ranges
(op_array=op_array@entry=0x7ffff6075008, ssa=ssa@entry=0x7ffff6097028)
    at
/build/php7.1-kMIlXM/php7.1-7.1.0/ext/opcache/Optimizer/zend_inference.c:1954
#2  0x00007ffff5b133f3 in zend_ssa_inference
(arena=arena@entry=0x7fffffffa960,
op_array=op_array@entry=0x7ffff6075008, script=0x7ffff6075000, 
    ssa=ssa@entry=0x7ffff6097028) at
/build/php7.1-kMIlXM/php7.1-7.1.0/ext/opcache/Optimizer/zend_inference.c:4181
#3  0x00007ffff5afb7f7 in zend_dfa_analyze_op_array
(op_array=0x7ffff6075008, ctx=ctx@entry=0x7fffffffa960,
ssa=0x7ffff6097028, flags=0x7ffff6097024)
    at
/build/php7.1-kMIlXM/php7.1-7.1.0/ext/opcache/Optimizer/dfa_pass.c:106
#4  0x00007ffff5aef7e7 in zend_optimize_script
(script=script@entry=0x7ffff6075000, optimization_level=2147467263,
debug_level=0)
    at
/build/php7.1-kMIlXM/php7.1-7.1.0/ext/opcache/Optimizer/zend_optimizer.c:967
#5  0x00007ffff5adf1c4 in cache_script_in_shared_memory
(from_shared_memory=<synthetic pointer>, key_length=22, 
    key=0x7ffff5d2e6cc <accel_globals+556> "test.php:223344:223384",
new_persistent_script=0x7ffff6075000)
    at
/build/php7.1-kMIlXM/php7.1-7.1.0/ext/opcache/ZendAccelerator.c:1271
#6  persistent_compile_file (file_handle=<optimized out>, type=8) at
/build/php7.1-kMIlXM/php7.1-7.1.0/ext/opcache/ZendAccelerator.c:1863
#7  0x00007ffff589ff9d in xdebug_compile_file (file_handle=<optimized
out>, type=<optimized out>) at
/build/xdebug-_hXbf9/xdebug-2.5.0/build-7.1/xdebug.c:2153
#8  0x00005555557b469d in zend_execute_scripts ()
#9  0x0000555555754b18 in php_execute_script ()
#10 0x000055555584e1c9 in ?? ()
#11 0x000055555563d92f in main ()


Test script:
---------------
<?php
$a/-1;



-- 
Edit bug report at https://bugs.php.net/bug.php?id=73668&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=73668&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=73668&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=73668&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=73668&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=73668&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=73668&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=73668&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=73668&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=73668&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=73668&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=73668&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=73668&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=73668&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73668&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=73668&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=73668&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=73668&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73668&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=73668&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=73668&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#205804) next »