mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-26 17:46:34 +03:00
+2
-1
@@ -183,7 +183,8 @@ func parseUintBuf(b []byte) (int, int, error) {
|
||||
}
|
||||
return v, i, nil
|
||||
}
|
||||
if i >= maxIntChars {
|
||||
// Test for overflow.
|
||||
if v*10 < v {
|
||||
return -1, i, errTooLongInt
|
||||
}
|
||||
v = 10*v + int(k)
|
||||
|
||||
@@ -3,6 +3,5 @@
|
||||
package fasthttp
|
||||
|
||||
const (
|
||||
maxIntChars = 9
|
||||
maxHexIntChars = 7
|
||||
)
|
||||
|
||||
@@ -3,6 +3,5 @@
|
||||
package fasthttp
|
||||
|
||||
const (
|
||||
maxIntChars = 18
|
||||
maxHexIntChars = 15
|
||||
)
|
||||
|
||||
@@ -38,4 +38,5 @@ func TestParseUintSuccess(t *testing.T) {
|
||||
testParseUintSuccess(t, "123", 123)
|
||||
testParseUintSuccess(t, "1234567890", 1234567890)
|
||||
testParseUintSuccess(t, "123456789012345678", 123456789012345678)
|
||||
testParseUintSuccess(t, "9223372036854775807", 9223372036854775807)
|
||||
}
|
||||
|
||||
@@ -176,6 +176,7 @@ func TestParseUintError(t *testing.T) {
|
||||
|
||||
// too big num
|
||||
testParseUintError(t, "12345678901234567890")
|
||||
testParseUintError(t, "1234567890123456789012")
|
||||
}
|
||||
|
||||
func TestParseUfloatSuccess(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user