# GHSA-CJCW-9R77-4GWM: pgjdbc stores a different number for a BigDecimal outside the binary numeric range

- Database: GitHub
- Severity: CVSS 6.5 (Medium)
- Published: 2026-11-23
- Modified: 2026-11-23

## Tracked as

- [CVE-2026-134847](https://cve.now/CVE-2026-134847.md): pgjdbc numeric truncation in BigDecimal handling

## Affected versions

- org.postgresql:postgresql (Maven): through 42.7.14

## Description

### Summary

pgjdbc cut the weight and scale of a `BigDecimal` to 16 bits when it sent the value in binary. The server then stored a different number without an error.


### Details

The binary numeric format holds a 16-bit weight and a 14-bit scale. The driver did not check either. `999999.99e-262144` was stored as `999999.99`, and `1e131072` as `0`.

The driver also computed 10 to the power of the scale before it sent anything. A value such as `1e-200000000` kept a thread busy for minutes.

Binary transfer is on by default, so `setBigDecimal()` and `setObject()` used this path.


### Proof of concept

```java
PreparedStatement ps = conn.prepareStatement("SELECT ?::numeric");
ps.setBigDecimal(1, new BigDecimal("999999.99e-262144"));
ps.executeQuery(); // Returns 999999.99 instead of a numeric overflow error.
```

### Impact

An attacker who supplies a decimal number that the application parses can make it store a different number. A tiny value can pass a range check and be stored as a large one. A short input can also use minutes of CPU per request.

## References

- https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-cjcw-9r77-4gwm

Page: https://cve.now/GHSA-CJCW-9R77-4GWM

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
