aboutsummaryrefslogtreecommitdiff
path: root/gas/expr.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2017-02-22 10:37:52 +0100
committerJan Beulich <jbeulich@suse.com>2017-02-22 10:37:52 +0100
commitb0c53498a383cd5915786b0c321da48054e122ef (patch)
treee9af6ba585f8ef98d7dcd895dbd66566da09bb42 /gas/expr.c
parent11648de5a91658326748dea1e4965559e9bd7a0f (diff)
downloadgdb-b0c53498a383cd5915786b0c321da48054e122ef.zip
gdb-b0c53498a383cd5915786b0c321da48054e122ef.tar.gz
gdb-b0c53498a383cd5915786b0c321da48054e122ef.tar.bz2
gas: require an operand to .startof.()/.sizeof.()
Diffstat (limited to 'gas/expr.c')
-rw-r--r--gas/expr.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gas/expr.c b/gas/expr.c
index c6685ad..6fc707b 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -1154,6 +1154,10 @@ operand (expressionS *expressionP, enum expr_mode mode)
|| input_line_pointer[1] == 'T');
input_line_pointer += start ? 8 : 7;
SKIP_WHITESPACE ();
+
+ /* Cover for the as_bad () invocations below. */
+ expressionP->X_op = O_absent;
+
if (*input_line_pointer != '(')
as_bad (_("syntax error in .startof. or .sizeof."));
else
@@ -1163,6 +1167,16 @@ operand (expressionS *expressionP, enum expr_mode mode)
++input_line_pointer;
SKIP_WHITESPACE ();
c = get_symbol_name (& name);
+ if (! *name)
+ {
+ as_bad (_("expected symbol name"));
+ (void) restore_line_pointer (c);
+ if (c != ')')
+ ignore_rest_of_line ();
+ else
+ ++input_line_pointer;
+ break;
+ }
buf = concat (start ? ".startof." : ".sizeof.", name,
(char *) NULL);
@@ -1306,6 +1320,14 @@ operand (expressionS *expressionP, enum expr_mode mode)
SKIP_WHITESPACE_AFTER_NAME ();
c = get_symbol_name (& name);
+ if (! *name)
+ {
+ as_bad (_("expected symbol name"));
+ expressionP->X_op = O_absent;
+ (void) restore_line_pointer (c);
+ ignore_rest_of_line ();
+ break;
+ }
buf = concat (start ? ".startof." : ".sizeof.", name,
(char *) NULL);