1
0
mirror of https://github.com/golang/go synced 2024-10-05 16:31:21 -06:00
go/src/cmd/asm/internal
Didier Spezia 7437e3f02e cmd/asm: fix potential infinite loop in parser
For ARM machines, the assembler supports list of registers
operands such as [R1,R2].

A list missing a ']' results in the parser issuing many errors
and consuming all the tokens. At EOF (i.e. end of the line),
it still loops.

Normally, a counter is maintained to make sure the parser
stops after 10 errors. However, multiple errors occuring on the
same line are simply ignored. Only the first one is reported.
At most one error per line is accounted.

Missing ']' in a register list therefore results in an
infinite loop.

Fixed the parser by explicitly checking for ']' to interrupt
this loops

In the operand tests, also fixed a wrong entry which I think was
not set on purpose (but still led to a successful result).

Fixes #11764

Change-Id: Ie87773388ee0d21b3a2a4cb941d4d911d0230ba4
Reviewed-on: https://go-review.googlesource.com/13920
Reviewed-by: Rob Pike <r@golang.org>
2015-08-27 10:26:40 +00:00
..
arch cmd/asm: fix and test CALL, JMP aliases on arm, arm64, ppc64 2015-07-28 14:19:53 +00:00
asm cmd/asm: fix potential infinite loop in parser 2015-08-27 10:26:40 +00:00
flags all: retire architecture letter in file names, public API 2015-05-21 17:32:17 +00:00
lex cmd/internal/obj: update callers to Linkline{fmt,hist} and remove 2015-05-15 17:45:39 +00:00