-
Notifications
You must be signed in to change notification settings - Fork 389
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Search before asking
- I had searched in the issues and found no similar issues.
Version
require github.com/apache/fory/go/fory v0.0.0-20251210114924-170ff49a1cc4
go version go1.25.4 linux/amd64
Component(s)
Go
Minimal reproduce step
func main() {
f := fory.New(
fory.WithCompatible(true),
)
type A struct {
Name string
}
f.RegisterNamedType(A{}, "test.A")
a := A{Name: "hello"}
buf, err := f.Marshal(&a)
if err != nil {
log.Fatalf("err: %v", err)
}
log.Printf("buf: % x", buf)
b := A{}
err = f.Unmarshal(buf, &b)
if err != nil {
log.Fatalf("err: %v", err)
}
log.Printf("b: %v", b)
}What did you expect to see?
working deserialization
What did you see instead?
panic: runtime error: slice bounds out of range [:86073] with capacity 138
Anything Else?
changing the struct into
struct A {
FirstName string
LastName string
}gives panic: invalid string encoding: 3
changing the struct into
struct A {
FirstName string
}doesn't actually cause a panic, but somehow the result is wrong
Marshaling the struct directly instead of pointer actually works
buf, err := f.Marshal(a)
err = f.Unmarshal(buf, &b)Are you willing to submit a PR?
- I'm willing to submit a PR!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working