[PATCH] Fix as segfaults on invalid SSE5 insns

Meissner, Michael michael.meissner@amd.com
Thu Jan 3 16:28:00 GMT 2008


This looks fine by me.

--
Michael Meissner
AMD, MS 83-29
90 Central Street
Boxborough, MA 01719

> -----Original Message-----
> From: Jakub Jelinek [mailto:jakub@redhat.com]
> Sent: Saturday, December 29, 2007 2:20 PM
> To: H.J. Lu; Meissner, Michael
> Cc: binutils@sources.redhat.com
> Subject: [PATCH] Fix as segfaults on invalid SSE5 insns
> 
> Hi!
> 
> Gas ATM segfaults on invalid operands like:
> permpd  %xmm1, %xmm0, src1(%rip), %xmm0
> which current GCC trunk generates on sse5-permpX.c.
> While GCC should be fixed, gas shouldn't segfault.
> 
> process_drex initializes modrm_reg{,mem} to None (== 65535).  All
valid
> operands set those two to something else, but in case of invalid
operands
> process_drex calls as_bad, but leaves those fields at 65535.  Later on
> these 2 fields are used as indexes into arrays without checking.
> 
> I think it is better to just initialize to 0, i.e. something that
won't
> crash, we already issued diagnostics and 0 will allow us to get
further.
> 
> Ok to commit?
> 
> 2007-12-29  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* config/tc-i386.c (process_drex): Initialize modrm_reg and
> 	modrm_regmem to 0 instead of None.
> 
> --- gas/config/tc-i386.c.jj	2007-12-27 16:05:37.000000000 +0100
> +++ gas/config/tc-i386.c	2007-12-29 20:02:23.000000000 +0100
> @@ -3927,8 +3927,8 @@ finalize_imm (void)
>  static void
>  process_drex (void)
>  {
> -  i.drex.modrm_reg = None;
> -  i.drex.modrm_regmem = None;
> +  i.drex.modrm_reg = 0;
> +  i.drex.modrm_regmem = 0;
> 
>    /* SSE5 4 operand instructions must have the destination the same
as
>       one of the inputs.  Figure out the destination register and
cache
> 
> 	Jakub
> 





More information about the Binutils mailing list