Dan Sugalski (via RT) wrote:
# New Ticket Created by Dan Sugalski # Please include the string: [perl #33028]
# in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=33028 >



A plain

    ./parrot foo.pbc

when foo.pbc doesn't exist triggers a core dump on OS X.

strlen() is puking on the NULL return from Parrot_locate_runtime_file() in Parrot_readbc. Attached patch fixes this behavior.


--
      Matt

      Matthew Zimmerman
      Interdisciplinary Biophysics, University of Virginia
      http://www.people.virginia.edu/~mdz4c/
Index: src/embed.c
===================================================================
RCS file: /cvs/public/parrot/src/embed.c,v
retrieving revision 1.125
diff -u -B -r1.125 embed.c
--- src/embed.c	4 Dec 2004 09:09:01 -0000	1.125
+++ src/embed.c	13 Dec 2004 16:18:07 -0000
@@ -223,6 +223,11 @@
 
         fullname = Parrot_locate_runtime_file(interpreter, filename,
                 PARROT_RUNTIME_FT_PBC);
+        if ( fullname == NULL ) {
+            PIO_eprintf(interpreter, "Parrot VM: Can't locate %s, code %i.\n",
+                        filename, errno);
+            return NULL;
+        }
         fs = interpreter->current_file = string_make(interpreter, fullname,
                 strlen(fullname), "iso-8859-1", 0);
         if (!Parrot_stat_info_intval(interpreter, fs, STAT_EXISTS)) {

Reply via email to