Bug 20904 - AS: Assertion violation when handling whitespaces in expressions
Summary: AS: Assertion violation when handling whitespaces in expressions
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.28
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-02 04:37 UTC by Marcel Böhme
Modified: 2016-12-05 16:58 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Böhme 2016-12-02 04:37:08 UTC
Dear all,

The following bug was found with AFLFast, a fork of AFL, in a 24 hour fuzzing session on Binutils. Thanks also to Van-Thuan Pham.

The assembler fails with an assertion violation for the following execution on Ubuntu 16.04 x86_64 and 14.04 x86_64 for Binutils v2.26.1 and trunk. It works fine for v2.24:

$ printf "\"\x00.=&%%/  0" > test
$ ./as test
test: Assembler messages:
test: Warning: end of file in string; '"' inserted
test:1: Warning: missing closing '"'
test:1: Error: expecting mnemonic; got nothing
test:1: Internal error!
Assertion failure in operand at expr.c:1375.
Please report this bug.

SKIP_WHITESPACE really skips only one space-character, so that the next character can indeed be another space-character.

Best regards,
- Marcel
Comment 1 Sourceware Commits 2016-12-05 16:56:10 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=14c1428b29fff12d8119ce6f4703be0de08197af

commit 14c1428b29fff12d8119ce6f4703be0de08197af
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Dec 5 16:54:59 2016 +0000

    Fix ICE in assembler when passed a bogus input file.
    
    	PR gas/20904
    	* as.h (SKIP_ALL_WHITESPACE): New macro.
    	* expr.c (operand): Use it.
Comment 2 Nick Clifton 2016-12-05 16:58:53 UTC
Hi Marcel,

  Thanks for reporting this bug.  I have added a new macro: SKIP_ALL_WHITESPACE
  to avoid this problem.

Cheers
  Nick