-
Notifications
You must be signed in to change notification settings - Fork 416
Open
Description
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
package issue_test
import (
"testing"
"encoding/json"
"github.com/bytedance/sonic"
"github.com/stretchr/testify/require"
)
func TestIssue775_OutofRange(t *testing.T) {
var jv, sv struct {
ByteArr []uint8
}
data := []byte(`{"ByteArr": [1, 2999, -123, 3.14, 3]}`)
err := sonic.Unmarshal(data, &sv)
err2 := json.Unmarshal(data, &jv)
require.Equal(t, err2 == nil, err == nil)
require.Equal(t, jv, sv)
}
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
Error: Not equal:
expected: struct { ByteArr []uint8 }{ByteArr:[]uint8{0x1, 0x0, 0x0, 0x0, 0x3}}
actual : struct { ByteArr []uint8 }{ByteArr:[]uint8{0x1, 0x0}}
Diff:
--- Expected
+++ Actual
@@ -1,4 +1,4 @@
(struct { ByteArr []uint8 }) {
- ByteArr: ([]uint8) (len=5) {
- 00000000 01 00 00 00 03 |.....|
+ ByteArr: ([]uint8) (len=2) {
+ 00000000 01 00 |..|
}
Test: TestIssue775_OutofRange
--- FAIL: TestIssue775_OutofRange (0.02s)
Sonic version:
Please provide the version of Sonic you are using.
Environment:
The output of go env
.
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
No labels