Skip to content

fix(utils): add negative int validation in Int32ToUint32, Int64ToUint64, and Int32SliceToUint32Slice - #2048

Open
yappermoar-boop wants to merge 1 commit into
xmtp:mainfrom
yappermoar-boop:fix-utils-number-negative-int-conversions-and-slice-validation
Open

yappermoar-boop wants to merge 1 commit into
xmtp:mainfrom
yappermoar-boop:fix-utils-number-negative-int-conversions-and-slice-validation

Conversation

@yappermoar-boop

@yappermoar-boop yappermoar-boop commented Aug 12, 2026 •

Copy link
Copy Markdown

Added ErrNegativeInt validation in pkg/utils/number.go and pkg/utils/slice.go. Added Int32ToUint32 and Int64ToUint64 conversion helpers that return ErrNegativeInt if given negative inputs. Updated Int32SliceToUint32Slice to return ([]uint32, error) and reject negative int32 values rather than wrapping them into unexpected large uint32 integers.

Note

Add negative int validation to Int32ToUint32, Int64ToUint64, and Int32SliceToUint32Slice

  • Adds Int32ToUint32 and Int64ToUint64 in number.go that return a new ErrNegativeInt error instead of silently casting negative values.
  • Updates Int32SliceToUint32Slice in slice.go to return ([]uint32, error), returning ErrNegativeInt on the first negative element found.
  • Behavioral Change: Int32SliceToUint32Slice now has a two-value return; all existing callers must be updated to handle the new error return.

Macroscope summarized 73df0ee.

@yappermoar-boop
yappermoar-boop requested a review from a team as a code owner August 12, 2026 11:15
@octane-security-app

Copy link
Copy Markdown

Summary by Octane

New Contracts

No new contracts were added.

Updated Contracts

  • number.go: Added functions to convert int32/int64 to uint32/uint64 with error handling for negative values.
  • slice.go: Int32 to Uint32 conversion now checks for negative values and returns an error instead of nil.

🔗 Commit Hash: 73df0ee

@octane-security-app

Copy link
Copy Markdown

Overview

Vulnerabilities found: 1                                                                                
Severity breakdown: 1 Informational

Detailed findings

pkg/payerreport/store.go

  • Signature-change mismatch in payerreport/store convertPayerReport causes server build failure. See more

🔗 Commit Hash: 73df0ee
🛡️ Octane Dashboard: All vulnerabilities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant