Crash in tc-m68k.c:md_estimate_size_before_relax()

Nick Clifton nickc@cambridge.redhat.com
Wed Jan 2 09:21:00 GMT 2002


Hi Jason,

> I've encountered a bug in gas 2.11.93 20011223 that manifests itself
> as a crash in tc-m68k.c:md_estimate_size_before_relax() in the byte
> branch checks (which you touched on 2001-07-03).
> 
> The code in question:
>     
>           sym_frag = symbol_get_frag (fragP->fr_symbol);
>           if (S_GET_VALUE (fragP->fr_symbol) == sym_frag->fr_address)
>             {
>               fragS *l;
>             
>               for (l = fragP->fr_next; l != sym_frag; l = l->fr_next)
>                 if (l->fr_fix != 0)
>                     ^^^^^^^^^
>                     NULL-pointer deref here
>                   break;
>               if (l == sym_frag)
>                 fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);

I added a test for the NULL pointer and now your test case assembles
without dumping core.

Cheers
        Nick



More information about the Binutils mailing list