softlandia / cpd

code page detect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

panic in cpd.ValidUTF8

Lion34 opened this issue · comments

Stack trace:

"runtime error: index out of range [1024] with length 1024"
Stack:
3 0x00000000047c21e5 in github.com/softlandia/cpd.ValidUTF8
at /go/pkg/mod/github.com/softlandia/cpd@v0.0.0-20210117083209-2413526f2815/utf8.go:74
4 0x00000000047bfb15 in github.com/softlandia/cpd.CodepageDetect
at /go/pkg/mod/github.com/softlandia/cpd@v0.0.0-20210117083209-2413526f2815/cpd.go:49

This error occur when n, cp := testUTF8bitPattern(data[i]) returns n such i+n >= m (data contains not all bytes of multibyte utf8 char)

А можешь прислать строку которая вызывает панику -- запихаю её в тесты