ayush00git opened a new issue, #3718:
URL: https://github.com/apache/fory/issues/3718

   ## Bug
   
   In `go/fory/type_resolver.go` line 1018, the lazy-serializer-initialization 
path inside `getTypeInfo` discards the error returned by `createSerializer`:
   
   \`\`\`go
   serializer, err := r.createSerializer(value.Type(), false)
   if err != nil {
       fmt.Errorf("failed to create serializer: %w", err) // result unused — 
error lost
   }
   info.Serializer = serializer  // nil serializer stored in cache
   return info, nil              // false success returned to caller
   \`\`\`
   
   The \`fmt.Errorf\` result is never used (detected by \`go vet\`). On 
failure, a \`nil\` serializer is stored in both \`typesInfo\` and 
\`typePointerCache\`, and the function returns \`(info, nil)\` — hiding the 
failure from all callers. This leads to a nil-pointer panic or silent data 
corruption far from the actual failure site.
   
   All sibling call sites in the same file propagate the error correctly (e.g. 
\`getSerializerByType\` at line 942).
   
   ## Fix
   
   \`\`\`go
   if err != nil {
       return nil, fmt.Errorf("failed to create serializer: %w", err)
   }
   \`\`\`
   
   ## Regression test
   
   A white-box test seeds \`typesInfo\` with a nil-serializer entry for 
\`**int\` (pointer-to-pointer is explicitly rejected by \`createSerializer\`), 
calls \`getTypeInfo\`, and asserts:
   - a non-nil error is returned
   - no nil-serializer entry is left in \`typePointerCache\`
   
   ## Detected by
   
   \`go vet\`: \`type_resolver.go:1018:5: result of fmt.Errorf call not used\`


-- 
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]

Reply via email to