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


This patch fixes a segfault in r7928 when load_bytecode cannot find the 
pbc file. e.g.

.sub test
    # (Assumes hello.pbc doesn't exist)
    load_bytecode "hello.pbc"
    end
.end

Regards,

Nick
Index: src/packfile.c
===================================================================
--- src/packfile.c      (revision 7928)
+++ src/packfile.c      (working copy)
@@ -3079,7 +3079,12 @@
     ext = strrchr(filename, '.');
     if (ext && strcmp (ext, ".pbc") == 0) {
         pf = PackFile_append_pbc(interpreter, filename);
-        do_sub_pragmas(interpreter, pf, PBC_LOADED);
+        if (pf) {
+            do_sub_pragmas(interpreter, pf, PBC_LOADED);
+        }
+        else {
+            internal_exception(1, "Failed to load pbc file");
+        }
     }
     else {
 #if 0
@@ -3112,7 +3117,7 @@
             fixup_subs(interpreter, pf, PBC_LOADED);
         }
         else
-            internal_exception(1, "compiler return NULL PackFile");
+            internal_exception(1, "compiler returned NULL PackFile");
     }
 }
 

Reply via email to