[perl #41771] Uncaught Parse Error Leads to Segfault

0 views
Skip to first unread message

Chromatic

unread,
Mar 10, 2007, 4:20:45 AM3/10/07
to bugs-bi...@rt.perl.org
# New Ticket Created by chromatic
# Please include the string: [perl #41771]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41771 >


This code causes a segfault:

.sub test :main
get_results '(0)'
.end

From my reading of src/ops/core.ops, this is invalid syntax. From my reading
of IMCC's parser, there's no easy way to catch this. A correct invocation is
more likely:

.sub test :main
get_results '(0)', P1
# or
get_results '()'
.end

It's possible to add a null guard in compilers/imcc/pbc.c:1120, but I think
that's the wrong fix; the parser should warn on the error here.

-- c

Bob Rogers

unread,
Mar 11, 2007, 1:28:35 AM3/11/07
to perl6-i...@perl.org, bugs-bi...@rt.perl.org
From: chromatic (via RT) <parrotbug...@parrotcode.org>
Date: Sat, 10 Mar 2007 01:20:45 -0800

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

This code causes a segfault:

.sub test :main
get_results '(0)'
.end

From my reading of src/ops/core.ops, this is invalid syntax . . .

It's possible to add a null guard in compilers/imcc/pbc.c:1120, but I think
that's the wrong fix; the parser should warn on the error here.

-- c

This is the same issue as "#41097: Segfault in malformed get_results".
Detecting this as a syntax error is ideal, but it occurs to me that it
would also be a good idea to guard against malformed bytecode, lest it
become a security issue down the road.

-- Bob Rogers
http://rgrjr.dyndns.org/

Reply all
Reply to author
Forward
0 new messages