[PATCH][h8300, mt, tilegx, xstormy16] Replace unsafe alloca calls with xmalloc

Siddhesh Poyarekar siddhesh@redhat.com
Tue Aug 21 13:34:00 GMT 2012


Hi,

Here are more fixes to unsafe use of alloca in gdb for the targets
mentioned in the subject line. Like my earlier commit:

http://sourceware.org/ml/gdb-cvs/2012-07/msg00044.html

I have replaced potentially unsafe allocations on stack with
xmalloc/cleanup replacements. I have also moved value_contents calls in
those functions to before the xmalloc to ensure that the type sizes fit
into the host memory. This of course will come into play once the
changes in my earlier patch (still WIP):

http://sourceware.org/ml/gdb-patches/2012-08/msg00476.html

is committed. Until then, the value_contents change does not make any
difference.

I have only done a build test on x86_64 with --enable-targets=all to
make sure that the changes compile. I don't have a way to run the
testsuite to verify that this does not introduce any regressions.

Regards,
Siddhesh

gdb/ChangeLog:

	* h8300-tdep.c (h8300_push_dummy_call): Replace unsafe alloca
	with xmalloc/cleanup.
	* mt-tdep.c (mt_push_dummy_call): Likewise.
	* tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
	* xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unsafe-alloca.patch
Type: text/x-patch
Size: 4542 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20120821/875f8ef2/attachment.bin>


More information about the Gdb-patches mailing list