1. 07 Sep, 2015 4 commits
  2. 06 Sep, 2015 1 commit
  3. 05 Sep, 2015 6 commits
  4. 04 Sep, 2015 17 commits
  5. 03 Sep, 2015 11 commits
  6. 02 Sep, 2015 1 commit
    • Didier Spezia's avatar
      cmd/asm: fix several panics with erroneous input · df37c4b9
      Didier Spezia authored
      The parser tries to read as much information as possible,
      issuing some errors when needed. Errors generally do not
      stop the parsing.
      
      With some pathological input, it may result in various
      panics when the error message itself is built, or when the
      next operand is parsed. It happens while parsing
      pseudo-instructions.
      
      For instance, the following lines all generate a panic:
      
      	TEXT
      	TEXT%
      	TEXT 1,1
      	TEXT $"toto", 0, $1
      	FUNCDATA
      	DATA 0
      	DATA(0),1
      	FUNCDATA(SB
      	GLOBL 0, 1
      	PCDATA 1
      
      Added corresponding tests.
      
      Introduced a writer in the parser to capture error messages
      for testing purpose. It defaults to os.Stderr.
      
      Added an explicit check when symbol names cannot be displayed.
      
      Interrupted parsing early when the number of operands is wrong for
      pseudo-instructions.
      
      Note that the last point is a change of behavior, because some
      operands will not get parsed anymore in case of early error.
      
      IMO, it is acceptable, because only the first error of the line
      is considered anyway. If it is not acceptable, it can probably
      be improved at the price of a more verbose CL.
      
      Fixes #11765
      Fixes #11760
      Fixes #11759
      
      Change-Id: I9602a848132e358a1bccad794d7555e0823970dd
      Reviewed-on: https://go-review.googlesource.com/13925Reviewed-by: default avatarRob Pike <r@golang.org>
      df37c4b9