Skip to content
Permalink
Browse files

Fixed issue #1647: Memory corruption when a conditional breakpoint is…

… used
  • Loading branch information...
derickr committed Mar 21, 2019
1 parent 33967d8 commit 42525caa914a47e2b472b98835a05d3aa8d5d674
Showing with 37 additions and 1 deletion.
  1. +4 −0 tests/bug01647.inc
  2. +32 −0 tests/bug01647.phpt
  3. +1 −1 xdebug_handlers.c
@@ -0,0 +1,4 @@
<?php
$x=1;
$x+=1;
?>
@@ -0,0 +1,32 @@
--TEST--
Test for bug #1647: Memory corruption when a conditional breakpoint is used
--SKIPIF--
<?php if (getenv("SKIP_DBGP_TESTS")) { exit("skip Excluding DBGp tests"); } ?>
--FILE--
<?php
require 'dbgp/dbgpclient.php';
$data = file_get_contents(dirname(__FILE__) . '/bug01647.inc');
$commands = array(
'step_into',
'breakpoint_set -t line -n 2 -- JGZkc2hmZGs=',
'run',
);
dbgpRun( $data, $commands );
?>
--EXPECTF--
<?xml version="1.0" encoding="iso-8859-1"?>
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///tmp/xdebug-dbgp-test.php" language="PHP" xdebug:language_version="" protocol_version="1.0" appid="" idekey=""><engine version=""><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2099 by Derick Rethans]]></copyright></init>

-> step_into -i 1
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="file:///tmp/xdebug-dbgp-test.php" lineno="2"></xdebug:message></response>

-> breakpoint_set -i 2 -t line -n 2 -- JGZkc2hmZGs=
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2" id=""></response>

-> run -i 3
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="3" status="stopping" reason="ok"></response>
@@ -60,7 +60,7 @@ void xdebug_brk_info_dtor(xdebug_brk_info *brk_info)
xdfree(brk_info->file);
}
if (brk_info->condition) {
efree(brk_info->condition);
xdfree(brk_info->condition);
}
xdfree(brk_info);
}

0 comments on commit 42525ca

Please sign in to comment.
You can’t perform that action at this time.