From 772cea817d075c496091f4c735800f14159c5051 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Wed, 24 Feb 2016 16:20:59 -0800 Subject: [PATCH] cmd/compile: fix off-by-1 in getr 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 Reviewed-by: Robert Griesemer TryBot-Result: Gobot Gobot --- src/cmd/compile/internal/gc/lex.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/gc/lex.go b/src/cmd/compile/internal/gc/lex.go index 562b2b9001..71ed8d6841 100644 --- a/src/cmd/compile/internal/gc/lex.go +++ b/src/cmd/compile/internal/gc/lex.go @@ -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 { -- 2.48.1