The old one was inferior.
Fixes #10695.
Change-Id: Ia7fb88c9ceb1b10197b77a54f729865385288d98
Reviewed-on: https://go-review.googlesource.com/9709
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
{"%T", nil, "<nil>"},
{"%-1", 100, "%!(NOVERB)%!(EXTRA int=100)"},
{"%017091901790959340919092959340919017929593813360", 0, "%!(NOVERB)%!(EXTRA int=0)"},
+ {"%184467440737095516170v", 0, "%!(NOVERB)%!(EXTRA int=0)"},
// The "<nil>" show up because maps are printed by
// first obtaining a list of keys and then looking up
return 0, false, end
}
for newi = start; newi < end && '0' <= s[newi] && s[newi] <= '9'; newi++ {
- num = num*10 + int(s[newi]-'0')
- if num < 0 {
+ const maxInt32 = 1<<31 - 1 // 31 bits is plenty for a width.
+ max := maxInt32/10 - 1
+ if num > max {
return 0, false, end // Overflow; crazy long number most likely.
}
+ num = num*10 + int(s[newi]-'0')
isnum = true
}
return