fix(driver): parse exponent space info sizes#75
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 273a4ffeae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sizeInt, _ := size.Int(nil) | ||
| return sizeInt.Int64(), nil |
There was a problem hiding this comment.
Guard int64 conversion when parsing space sizes
Converting size.Int(nil) directly with Int64() can silently wrap on values outside the int64 range, so very large exponent inputs now deserialize to incorrect negative/garbled sizes instead of failing. For example, parsing "1e19" yields a wrapped negative int64. Before this change, oversized/non-integer forms were rejected by strconv.ParseInt; now this path accepts them and corrupts SpaceInfo values. Add an explicit range check (e.g., IsInt64) and return an error when out of bounds.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3744dc9854
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sizeInt, _ := size.Int(nil) | ||
| if !sizeInt.IsInt64() { |
There was a problem hiding this comment.
Guard against infinity before converting to big.Int
parseSpaceSize can panic on valid string inputs like "Inf" or "-Inf": big.ParseFloat accepts those tokens and returns an infinite *big.Float, but size.Int(nil) then returns a nil *big.Int, so calling IsInt64() dereferences nil and crashes unmarshalling. This is a regression from the previous strconv.ParseInt path (which returned an error), and it can be triggered whenever the upstream API (or a proxy) sends an infinite size string.
Useful? React with 👍 / 👎.
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Source
Test Plan
go test ./pkg/driver -run 'TestInfoResponseUnmarshals(Decimal|Exponent)SpaceSizes' -count=1\n- [x]git diff --check\n- [x]go test ./... -run 'TestInfoResponseUnmarshals(Decimal|Exponent)SpaceSizes' -count=1