Bug 30117 - internal error in parse_register at tc-i386.c:13060
Summary: internal error in parse_register at tc-i386.c:13060
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.41
: P2 normal
Target Milestone: ---
Assignee: Jan Beulich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-13 02:09 UTC by Alan Modra
Modified: 2023-02-16 09:09 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 Alan Modra 2023-02-13 02:09:21 UTC
Reduced from a 37k file of fuzzed nonsense.
cat > xxx <<\EOF
x=s
s=%ymm5%0
y=s
or $6,x
EOF
gas/as-new xxx
xxx: Assembler messages:
xxx:4: Internal error in parse_register at /home/alan/src/binutils-gdb/gas/config/tc-i386.c:13060.
Please report this bug.
Comment 1 Jan Beulich 2023-02-13 08:29:05 UTC
I'll look into that.
Comment 2 Sourceware Commits 2023-02-16 08:40:20 UTC
The master branch has been updated by Jan Beulich <jbeulich@sourceware.org>:

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

commit 0ccade1ae2c00337d2b0bba2a175a060b93728a8
Author: Jan Beulich <jbeulich@suse.com>
Date:   Thu Feb 16 09:40:08 2023 +0100

    x86/gas: replace inappropriate assertion when parsing registers
    
    PR gas/30117
    Once a symbol had its expression evaluated, the "segment" of the symbol
    may be reg_section if a register is merely involved in the expression,
    not just when the expression references a "plain" register. Therefore
    the first of the assertions put in place by 4d1bb7955a8b was too strict.
    Convert it to an if() to deal with situations like this one found by
    fuzzing:
    
            x=s
            s=%eax+0
            y=s
            or $6,x
    
    In non-debug builds this also avoids potentially silently generating bad
    code.
Comment 3 Jan Beulich 2023-02-16 09:09:29 UTC
Sorted.