* [Bug translator/12176] New: string literal at end of file crashes parser
@ 2010-11-01 10:55 mjw at redhat dot com
2010-11-01 11:18 ` [Bug translator/12176] " mjw at redhat dot com
0 siblings, 1 reply; 2+ messages in thread
From: mjw at redhat dot com @ 2010-11-01 10:55 UTC (permalink / raw)
To: systemtap
http://sourceware.org/bugzilla/show_bug.cgi?id=12176
Summary: string literal at end of file crashes parser
Product: systemtap
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: translator
AssignedTo: systemtap@sources.redhat.com
ReportedBy: mjw@redhat.com
A string literal at the end of a file crashes the parser:
$ cat testsuite/parseok/end_string.stp
#! stap -p1
probe begin { log(last_var_is_last_string); exit(); }
// Parser used to barf when last token in a file was a string
global last_var_is_last_string="HelloWorld"
$ gdb stap
% run testsuite/parseok/end_string.stp
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7e8e8d6 in parser::parse_literal (this=0x7fffffffd050)
at /home/mark/src/systemtap/parse.cxx:1708
1708 while (peek()->type == tok_string && !input.ate_comment)
(gdb)
(gdb) bt
#0 0x00007ffff7e8e8d6 in parser::parse_literal (this=0x7fffffffd050)
at /home/mark/src/systemtap/parse.cxx:1708
#1 0x00007ffff7e8eda0 in parser::parse_global (this=0x7fffffffd050, globals=
std::vector of length 1, capacity 1 = {...})
at /home/mark/src/systemtap/parse.cxx:1510
#2 0x00007ffff7e97133 in parser::parse (this=0x7fffffffd050)
at /home/mark/src/systemtap/parse.cxx:1180
#3 0x00007ffff7e97465 in parse (s=<value optimized out>,
n=<value optimized out>, pr=<value optimized out>)
at /home/mark/src/systemtap/parse.cxx:182
#4 0x00007ffff7e77a11 in passes_0_4 (argc=<value optimized out>,
argv=<value optimized out>) at /home/mark/src/systemtap/main.cxx:566
#5 main (argc=<value optimized out>, argv=<value optimized out>)
at /home/mark/src/systemtap/main.cxx:874
Testing the following patch:
diff --git a/parse.cxx b/parse.cxx
index da3b881..912fef4 100644
--- a/parse.cxx
+++ b/parse.cxx
@@ -1705,9 +1705,12 @@ parser::parse_literal ()
// PR11208: check if the next token is also a string literal;
auto-concat
// This is complicated to the extent that we need to skip intermediate
wh
// XXX: but not comments
- while (peek()->type == tok_string && !input.ate_comment)
- ls->value.append(next()->content); // consume and append the token
-
+ const token *n = peek();
+ while (n != NULL && n->type == tok_string && !input.ate_comment)
+ {
+ ls->value.append(next()->content); // consume and append the token
+ n = peek();
+ }
l = ls;
}
else
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug translator/12176] string literal at end of file crashes parser
2010-11-01 10:55 [Bug translator/12176] New: string literal at end of file crashes parser mjw at redhat dot com
@ 2010-11-01 11:18 ` mjw at redhat dot com
0 siblings, 0 replies; 2+ messages in thread
From: mjw at redhat dot com @ 2010-11-01 11:18 UTC (permalink / raw)
To: systemtap
http://sourceware.org/bugzilla/show_bug.cgi?id=12176
Mark Wielaard <mjw at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #1 from Mark Wielaard <mjw at redhat dot com> 2010-11-01 11:17:48 UTC ---
commit 83d4d1a3d2484833af1299de6062f27613a8b9b5
Author: Mark Wielaard <mjw@redhat.com>
Date: Mon Nov 1 11:55:35 2010 +0100
PR12176 String literal at end of file crashes parser.
* parse.cxx (parser::parse_literal): Only inspect next token if there is
one
* testsuite/parseok/end_string.stp: New testcase.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-01 11:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-01 10:55 [Bug translator/12176] New: string literal at end of file crashes parser mjw at redhat dot com
2010-11-01 11:18 ` [Bug translator/12176] " mjw at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).