We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b05f809 commit 46309b3Copy full SHA for 46309b3
parser/lexer/utils.go
@@ -32,10 +32,11 @@ func unescape(value string) (string, error) {
32
// The string contains escape characters.
33
// The following logic is adapted from `strconv/quote.go`
34
var runeTmp [utf8.UTFMax]byte
35
- if n >= 2*math.MaxInt/3 {
+ size := 3 * uint64(n) / 2
36
+ if size >= math.MaxInt {
37
return "", fmt.Errorf("too large string")
38
}
- buf := make([]byte, 0, 3*n/2)
39
+ buf := make([]byte, 0, size)
40
for len(value) > 0 {
41
c, multibyte, rest, err := unescapeChar(value)
42
if err != nil {
0 commit comments