cvsuser 04/12/14 01:48:33
Modified: src embed.c
Log:
[perl #33028] Parrot cores when asked to run a nonexistent bytecode file
> ./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.
Courtey of Matthew Zimmerman <[EMAIL PROTECTED]>
Revision Changes Path
1.126 +6 -1 parrot/src/embed.c
Index: embed.c
===================================================================
RCS file: /cvs/public/parrot/src/embed.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -r1.125 -r1.126
--- embed.c 4 Dec 2004 09:09:01 -0000 1.125
+++ embed.c 14 Dec 2004 09:48:33 -0000 1.126
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: embed.c,v 1.125 2004/12/04 09:09:01 leo Exp $
+$Id: embed.c,v 1.126 2004/12/14 09:48:33 leo Exp $
=head1 NAME
@@ -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)) {