[xdebug-dev] xdebug xdebug/xdebug_code_coverage.c xdebug/tests/bug00318.inc xdebug/tests/bug00318.phpt - Fixed bug #318: Segmentation Fault in code coverage analysis.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Sat, 27 Oct 2007 17:47:42 +0200

Date: Sat Oct 27 17:47:42 CEST 2007
User: Derick Rethans
Directory: xdebug

Log Message:
[1.00]
- Fixed bug #318: Segmentation Fault in code coverage analysis.

Modified files:
           xdebug/xdebug_code_coverage.c (version: 1.35)
Added files:
           xdebug/tests/bug00318.inc (new version: 1.1)
           xdebug/tests/bug00318.phpt (new version: 1.1)

[FILE: /xdebug/xdebug_code_coverage.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- xdebug/xdebug_code_coverage.c:1.34 Sun Oct 21 08:45:25 2007 GMT
+++ xdebug/xdebug_code_coverage.c Sat Oct 27 13:47:42 2007 GMT
@@ -144,7 +144,7 @@
         } else if (opcode.opcode == ZEND_BRK || opcode.opcode == ZEND_CONT) {
                 zend_brk_cont_element *el;
 
- if (opcode.op2.op_type == IS_CONST) {
+ if (opcode.op2.op_type == IS_CONST && opcode.op1.u.opline_num > -1) {
                         el = xdebug_find_brk_cont(&opcode.op2.u.constant, opcode.op1.u.opline_num, opa);
                         *jmp1 = opcode.opcode == ZEND_BRK ? el->brk : el->cont;
                         return 1;

[FILE: /xdebug/tests/bug00318.inc]

<?php
//FILE: faulty.php
if(true){break;} // 'Continue' also causes problems
?>

[FILE: /xdebug/tests/bug00318.phpt]

--TEST--
Test for bug #318: Segmentation Fault in code coverage analysis
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
--INI--
xdebug.default_enable=1
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.profiler_enable=0
xdebug.trace_format=0
--FILE--
<?php
// Run me from the PHP CLI
xdebug_start_code_coverage(XDEBUG_CC_DEAD_CODE | XDEBUG_CC_UNUSED);
// MUST be both code coverage options to cause problems
include(dirname(__FILE__).'/bug00318.inc'); // File with problem in it.
xdebug_stop_code_coverage();
?>
--EXPECTF--
Fatal error: Cannot break/continue 1 level in %sbug00318.inc on line 3

Call Stack:
%w%f %w%d 1. {main}() %sbug00318.php:0
%w%f %w%d 2. include('%sbug00318.inc') %sbug00318.php:5
Received on Sat Oct 27 2007 - 17:48:04 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST