shangxinxiaolin opened a new issue, #3759:
URL: https://github.com/apache/dubbo-go/issues/3759

   ### What happened?
   
   `MapGeneralizer.Generalize()` panics when passed a typed nil pointer instead 
of returning a nil value. This also happens when the pointer is an element of a 
slice or a value in a map. Both ordinary Go pointers and pointers implementing 
`hessian.POJO` are affected.
   
   ### Reproduction
   
   ```go
   package main
   
   import "dubbo.apache.org/dubbo-go/v3/filter/generic/generalizer"
   
   func main() {
       var value *int
       _, _ = generalizer.GetMapGeneralizer().Generalize(value)
   }
   ```
   
   Actual: `panic: reflect: call of reflect.Value.Interface on zero Value`.
   
   Expected: `(nil, nil)`, consistent with an untyped nil input and nil pointer 
fields in structs.
   
   `objToMap()` only checks `obj == nil`. A typed nil pointer passes that 
check, and the pointer branch calls `v.Elem().Interface()` on an invalid value. 
For a nil POJO pointer, the function enters the struct branch and can panic 
when invoking `JavaClassName()` or accessing fields.
   
   ### Environment and validation
   
   - Upstream `develop`: `5cfd927a52a48cb6a673f06b6549133b12b9464e`
   - Go 1.25.5, Windows amd64
   - Reproduced via the public `Generalize` API with six regression cases: 
plain, POJO, scalar and indirect pointers, slice elements, and map values. All 
six fail before the fix and pass afterwards.
   - This reproduction exercises conversion only and does not require a 
registry or running RPC server.
   
   A minimal fix and regression tests are ready; I am submitting the linked 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]

Reply via email to