# New Ticket Created by  NotFound 
# Please include the string:  [perl #56346]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56346 >


Some debug opcodes assumes that the debugger is already inited or that
a file to debug is loaded, and segfaults otherwise. This patch add
some checks and throws on bad usages.

-- 
Salu2
Index: src/ops/debug.ops
===================================================================
--- src/ops/debug.ops	(revisión: 28694)
+++ src/ops/debug.ops	(copia de trabajo)
@@ -66,6 +66,9 @@
 op debug_load(inconst STR) :base_debug {
     char *f;
 
+    if (!(interp->pdb)) {
+        real_exception(interp, NULL, 0, "No Debugger");
+    }
     if (!(interp->pdb->state & PDB_BREAK)) {
         f = string_to_cstring(interp, ($1));
         PDB_load_source(interp, f);
@@ -92,6 +95,12 @@
 op debug_break() :base_debug {
     const char *command;
 
+    if (!(interp->pdb)) {
+        real_exception(interp, NULL, 0, "No Debugger");
+    }
+    if (!(interp->pdb->file)) {
+        real_exception(interp, NULL, 0, "No file loaded to debug");
+    }
     if (!(interp->pdb->state & PDB_BREAK)) {
         interp->pdb->state |= PDB_BREAK;
         interp->pdb->state |= PDB_STOPPED;

Reply via email to