Skip to content

apd: prevent NewFromString parsing invalid decimals#145

Merged
mw5h merged 1 commit intocockroachdb:masterfrom
jms-bc:master
Mar 13, 2026
Merged

apd: prevent NewFromString parsing invalid decimals#145
mw5h merged 1 commit intocockroachdb:masterfrom
jms-bc:master

Conversation

@jms-bc
Copy link
Contributor

@jms-bc jms-bc commented Mar 12, 2026

Fixes a parsing bug outlined in #144 where sign characters (+, -) immediately after a decimal point bypass setString's sign validation and are passed to big.Int.SetString, which accepts them. This produces corrupt Decimal values.

The fix validates that the mantissa contains only ASCII digits (0-9) after the decimal point and exponent have been removed, before it is passed to big.Int.SetString.

Related: #120

Reject non-digit characters in the mantissa.
Copy link
Contributor

@mw5h mw5h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Thanks for this fix!

mw5h added a commit to mw5h/apd that referenced this pull request Mar 13, 2026
- Drop EOL Go versions 1.15–1.18, add Go 1.24
- Bump actions/checkout v2 → v4
- Bump actions/setup-go v2 → v5
- Bump uraimo/run-on-arch-action v2.1.1 → v3
- Update ARM test distro from ubuntu20.04 (EOL) to ubuntu24.04
- Bump GCAssert minimum Go to 1.22 to match matrix

The ubuntu20.04 ARM docker images are no longer available, causing
CI failures for PRs (e.g. cockroachdb#145).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mw5h added a commit to mw5h/apd that referenced this pull request Mar 13, 2026
- Drop EOL Go versions 1.15–1.18, add Go 1.24
- Bump actions/checkout v2 → v4
- Bump actions/setup-go v2 → v5
- Bump uraimo/run-on-arch-action v2.1.1 → v3
- Update ARM test distro from ubuntu20.04 (EOL) to ubuntu24.04
- Bump GCAssert minimum Go to 1.22 to match matrix

The ubuntu20.04 ARM docker images are no longer available, causing
CI failures for PRs (e.g. cockroachdb#145).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mw5h added a commit to mw5h/apd that referenced this pull request Mar 13, 2026
- Drop EOL Go versions 1.15–1.18, add Go 1.24
- Bump actions/checkout v2 → v4
- Bump actions/setup-go v2 → v5
- Bump uraimo/run-on-arch-action v2.1.1 → v3
- Update ARM test distro from ubuntu20.04 (EOL) to ubuntu24.04
- Bump GCAssert minimum Go to 1.22 to match matrix

The ubuntu20.04 ARM docker images are no longer available, causing
CI failures for PRs (e.g. cockroachdb#145).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mw5h mw5h merged commit d9564ab into cockroachdb:master Mar 13, 2026
0 of 108 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