]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: fix off-by-1 in getr
authorMatthew Dempsky <mdempsky@google.com>
Thu, 25 Feb 2016 00:20:59 +0000 (16:20 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 25 Feb 2016 00:46:16 +0000 (00:46 +0000)
Introduced by (and missed during code review of) golang.org/cl/19847.

Change-Id: I03b76f36e5da69c31730380592dfa1c32570e17f
Reviewed-on: https://go-review.googlesource.com/19912
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/lex.go

index 562b2b90011ccce23644c308ac339e24c72b7110..71ed8d68413e6665199d1ee2fd3bf9f34c5ba47d 100644 (file)
@@ -1873,7 +1873,7 @@ redo:
                // The string conversion here makes a copy for passing
                // to fmt.Printf, so that buf itself does not escape and
                // can be allocated on the stack.
-               Yyerror("illegal UTF-8 sequence % x", string(buf[:i+1]))
+               Yyerror("illegal UTF-8 sequence % x", string(buf[:i]))
        }
 
        if r == BOM {