jsonutil.UnmarshalJSON()
causes a panic when attempting to unmarshal into a pre-initialized slice with insufficient length
#5330
Labels
Describe the bug
This issue occurs when unmarshaling might be attempted more than once, such as when a request is retried after a previous unmarshaling failure. I encountered this while calling the GuardDuty GetFinding API.
For instance, the following code triggers a panic:
Regression Issue
Expected Behavior
Either return an error or re-create the slice
Current Behavior
Panic
Reproduction Steps
Possible Solution
Boundary check in
jsonutil.unmarshaler.unmarshalList
ifvalue.IsNil() == true
Additional Information/Context
SDK version used
v1.55.5
Environment details (Version of Go (
go version
)? OS name and version, etc.)go version go1.23.2 darwin/arm64
The text was updated successfully, but these errors were encountered: