hsjsstn opened a new pull request, #400:
URL: https://github.com/apache/dubbo-go-hessian2/pull/400

   <!--  Thanks for sending a pull request! 
   -->
   
   **What this PR does**:
   
   ConvertSliceValueType picked the accessor from the destination element kind, 
then called itemValue.Float() / Int() / Uint() on the source, which panics 
unless the source kind matches. Now it checks the source kind first and returns 
the error the function already returns.
   
   The uint branch accepts int sources on purpose. SetValue does the same a few 
lines down with the comment hessian only support 64-bit signed long integer, so 
rejecting int there would turn a valid payload into an error.
   
   Left the float branch strict. There’s no precedent in SetValue for 
converting int sources to float.
   
   **Which issue(s) this PR fixes**:
   <!--
   *Automatically closes linked issue when PR is merged.
   Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
   _If PR is about `failing-tests or flakes`, please post the related 
issues/tests in a comment and do not use `Fixes`_*
   -->
   Fixes #398 
   
   **Special notes for your reviewer**:
   
   Tests cover a valid conversion and a kind mismatch for each numeric branch, 
plus []uint64 from int64 for the uint case above.
   
   Can allow int on the float branch too if you’d rather have it.
   
   **Does this PR introduce a user-facing change?**:
   <!--
   If no, just write "NONE" in the release-note block below.
   If yes, a release note is required:
   Enter your extended release note in the block below. If the PR requires 
additional action from users switching to the new release, include the string 
"action required".
   -->
   
   Yes, decoding a list whose element kind doesn’t match the destination now 
returns an error instead of panicking.
   
   ```release-note
   Fix a panic in ConvertSliceValueType when the source element kind does not 
match the destination element kind. Such input now returns an error.
   ```


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