Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/text/transform: "short internal buffer" in transform.String() #24170

Closed
vmarkovtsev opened this issue Feb 28, 2018 · 2 comments
Closed

x/text/transform: "short internal buffer" in transform.String() #24170

vmarkovtsev opened this issue Feb 28, 2018 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@vmarkovtsev
Copy link

vmarkovtsev commented Feb 28, 2018

What version of Go are you using (go version)?

go version go1.9.4 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="censored"
GORACE=""
GOROOT="/usr/lib/go-1.9"
GOTOOLDIR="/usr/lib/go-1.9/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build137536990=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

Run this code:

package main

import (
	"io/ioutil"
	"fmt"
	"os"
	"unicode"

	"golang.org/x/text/runes"
	"golang.org/x/text/transform"
	"golang.org/x/text/unicode/norm"
)

func main() {
	buffer, _ := ioutil.ReadAll(os.Stdin)
	normalized, _, err := transform.String(
		transform.Chain(norm.NFD, runes.Remove(runes.In(unicode.Mn)), norm.NFC),
		string(buffer))
	if err != nil {
		panic(err)
	}
	fmt.Print(normalized)
}

as follows:

cat killer.txt | go run main.go

where killer.txt is attached: killer.txt

What did you expect to see?

The printed text, basically the same as the input.

What did you see instead?

panic: transform: short internal buffer

goroutine 1 [running]:
main.main()
	/home/vadim/Projects/go-workspace/src/gopkg.in/src-d/go-license-detector.v1/bug.go:20 +0x28b
exit status 2
@ianlancetaylor ianlancetaylor changed the title golang.org/x/text/transform: "short internal buffer" in transform.String() x/text/transform: "short internal buffer" in transform.String() Feb 28, 2018
@gopherbot gopherbot added this to the Unreleased milestone Feb 28, 2018
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 28, 2018
@discoli-zz
Copy link

I had this issue as well, vouch for this

@gopherbot
Copy link

Change https://golang.org/cl/145558 mentions this issue: unicode/norm: correct use of ErrShortDst

@golang golang locked and limited conversation to collaborators Oct 30, 2019
@rsc rsc unassigned mpvl Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants