bad assumption in gas/stabs.c?
Nick Clifton
nickc@redhat.com
Thu Mar 15 10:45:00 GMT 2001
Hi DJ,
> In s_stab_generic, we see code like this:
>
> string = demand_copy_C_string (&length);
> ...
> #ifdef md_flush_pending_output
> md_flush_pending_output ();
> #endif
> ...
> obstack_free (¬es, string);
>
> Now, in at least one case I saw, md_flush_pending_output called
> symbol_new(), which used the notes obstack to allocate something, and
> the obstack_free() freed more than just the string, which caused
> memory corruption, and eventually an abort.
>
> The documentation doesn't say md_flush_pending_output can't do that.
>
> The attached patch guards against this case, but is there some better
> solution?
Does the string actually need to be copied into an obstack ? It seems
to me that the same effect could be achieved simply by scanning to the
end of the string, temporarily replacing the closing " with a NUL and
then restoring it after the processing in s_stab_generic has finished.
The patch seems fine though, so if you prefer that solution, please go
ahead and apply it.
Cheers
Nick
More information about the Binutils
mailing list