[xdebug-dev] xdebug xdebug/xdebug_code_coverage.c xdebug/tests/bug00313.inc xdebug/tests/bug00313.phpt - MFH: Fixed bug #313: Code coverage crashes on empty PHP files.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Mon, 29 Oct 2007 19:59:55 +0100

Date: Mon Oct 29 19:59:55 CET 2007
User: Derick Rethans
Directory: xdebug

Log Message:
[0.25]
- MFH: Fixed bug #313: Code coverage crashes on empty PHP files.

Modified files:
           xdebug/xdebug_code_coverage.c (version: 1.32.2.4)
Added files:
           xdebug/tests/bug00313.inc (new version: 1.1.2.2)
           xdebug/tests/bug00313.phpt (new version: 1.1.2.2)

[FILE: /xdebug/xdebug_code_coverage.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.32.2.3
retrieving revision 1.32.2.4
diff -u -r1.32.2.3 -r1.32.2.4
--- xdebug/xdebug_code_coverage.c:1.32.2.3 Sat Oct 27 13:48:00 2007 GMT
+++ xdebug/xdebug_code_coverage.c Mon Oct 29 17:59:55 2007 GMT
@@ -234,7 +234,7 @@
 #ifdef ZEND_ENGINE_2
         /* Check for abstract methods and simply return from this function in those
          * cases. */
- if (opa->opcodes[opa->size - 4].opcode == ZEND_RAISE_ABSTRACT_ERROR)
+ if (opa->size >= 4 && opa->opcodes[opa->size - 4].opcode == ZEND_RAISE_ABSTRACT_ERROR)
         {
                 return;
         }

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

<?php
?>

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

--TEST--
Test for bug #313: Segmentation Fault in code coverage analysis on empty PHP files.
--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__).'/bug00313.inc'); // File with problem in it.
xdebug_stop_code_coverage();
echo "ALIVE\n";
?>
--EXPECTF--
ALIVE
Received on Mon Oct 29 2007 - 19:59:58 GMT

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