PR22714, Assembler preprocessor loses track of \@
authorAlan Modra <amodra@gmail.com>
Wed, 31 Jan 2018 03:04:18 +0000 (13:34 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 31 Jan 2018 06:28:26 +0000 (16:58 +1030)
commitab1fadc6b2f057b817e1fc093650b63d9f6dd6c5
treee55f2c97682850714204488b0b4bcd859f416ac6
parent29236ca20ad953ead58ab791ec376ee7921624b8
PR22714, Assembler preprocessor loses track of \@

The PR22714 testcase is such that the input buffer processed by
do_scrub_chars ends on this line

1: bug "Returning to usermode but unexpected PSR bits set?", \@

right at the backslash.  (The line is part of a macro definition.)
The next input buffer then starts with '@' which starts a comment on
ARM, and the check for \@ fails due to to == tostart.  Now it would be
possible to simply access to[-1] in this particular case, but that's
ugly, and to be absolutely safe from people deliberately trying to
crash gas we'd need the read.c:read_a_source_file buffer passed to
do_scrub_chars to have a single byte pad at the start.

PR 22714
* app.c (last_char): New static var.
(struct app_save): Add last_char field.
(app_push, app_pop): Handle it.
(do_scrub_chars): Use last_char in test for "\@".  Set last_char.
gas/ChangeLog
gas/app.c
This page took 0.023819 seconds and 4 git commands to generate.