Skip to content

fix[sqlx-postgres]: do a checked_mul to prevent panic'ing - #3919

Merged
abonander merged 1 commit into
transact-rs:mainfrom
nhatcher-frequenz:bugfix/large_number_overflow
Jul 4, 2025
Merged

fix[sqlx-postgres]: do a checked_mul to prevent panic'ing#3919
abonander merged 1 commit into
transact-rs:mainfrom
nhatcher-frequenz:bugfix/large_number_overflow

Conversation

@nhatcher-frequenz

Copy link
Copy Markdown
Contributor

This was discovered while reading very large negative numbers in a production PostgreSQL Database.

Without the fix the library will panic. Please see attached testcase.

Does your PR solve an issue?

I didn't find an open issue for this.

Is this a breaking change?

No. But before this change consumers of the library will panic.

@nhatcher-frequenz
nhatcher-frequenz force-pushed the bugfix/large_number_overflow branch from 2755345 to c2849fc Compare July 2, 2025 14:15
@abonander

Copy link
Copy Markdown
Collaborator

Do you mind adding a regression test for this?

@nhatcher-frequenz

Copy link
Copy Markdown
Contributor Author

Hi @abonander, there is already a regression test. Am I missing something? The test will fail without the fix

@abonander

Copy link
Copy Markdown
Collaborator

Ah, sorry. I meant a test that actually tries to decode such a value from the database. But this is fine too.

@abonander
abonander merged commit 9de593a into transact-rs:main Jul 4, 2025
84 checks passed
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.

2 participants