ayush00git opened a new issue, #3614: URL: https://github.com/apache/fory/issues/3614
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/fory/issues) and found no similar issues. ### Version 0.17.0 ### Component(s) Go ### Minimal reproduce step Run these tests- (just place them inside a test file and run test script) ```go func TestRefResolver_OOBPanic(t *testing.T) { resolver := newRefResolver(true) // Enable tracking buffer := NewByteBuffer(nil) // Craft a buffer with RefFlag (-2) followed by a huge RefID (9999) buffer.WriteInt8(RefFlag) buffer.WriteVarUint32(9999) buffer.SetReaderIndex(0) var ctxErr Error // This currently PANICS. The fix should prevent the panic. require.NotPanics(t, func() { resolver.ReadRefOrNull(buffer, &ctxErr) }, "RefResolver.GetReadObject should not panic on OOB index") } func TestMetaStringResolver_NegativeIndexPanic(t *testing.T) { resolver := NewMetaStringResolver() buffer := NewByteBuffer(nil) // header = 1 means (header & 1 != 0) is true (it's a reference) // and length = header >> 1 = 0. // index = length - 1 = -1. buffer.WriteVarUint32Small7(1) buffer.SetReaderIndex(0) var ctxErr Error // This currently PANICS. The fix should prevent the panic. require.NotPanics(t, func() { _, err := resolver.ReadMetaStringBytes(buffer, &ctxErr) if err == nil { // If it didn't panic, it should at least return an error t.Errorf("Expected error for negative index, got nil") } }, "MetaStringResolver should not panic on negative index") } ``` ### What did you expect to see? . ### What did you see instead? . ### Anything Else? . ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
