[PATCH] ia64 diagnostics

James E Wilson wilson@specifixinc.com
Thu Jan 27 03:25:00 GMT 2005


On Mon, 2005-01-24 at 02:24, Jan Beulich wrote:
> 	* config/tc-ia64.c (parse_operands): Parse all specified
> operands,
> 	immediately discarding (but counting) those exceeding the
> maximum

This looks mostly OK.  You have one comment that doesn't use a sentence,
but you copied it from elsewhere, so I will let that go.  I'd rather see
comments in the source file than in the ChangeLog entry.

A testcase would be useful.

> +	  || (num_operands > 0 && !idesc->operands[num_operands - 1]))

This part looks like an out-of-bounds array reference.  Since we are
counting all arguments, it is possible for num_operands to be larger
than the idesc->operands array size.  There are also other later places
that will result in out-of-bounds array references.  I think you need an
extra test before this line like
	|| (num_operands > NELEMS (CURR_SLOT.opnd))
Since this is a loop invariant, this test could be performed before
entering the loop, and just exit with an appropriate error if we have
too many operands.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com




More information about the Binutils mailing list