SIGN IN SIGN UP

Fix panic in JSONB decoder on invalid version byte (#4158)

* Fix panic in JSONB decoder on invalid version byte

Replace assert_eq! with proper error handling to prevent panic on
untrusted database input. The Decode trait contract requires returning
Result<T, Error>, but the assertion would cause a panic instead.

This issue was discovered through fuzzing and can be triggered by:
- Malformed JSONB data in the database
- Database corruption
- Future PostgreSQL versions with different JSONB formats

The fix replaces the assertion with a conditional check that returns
an appropriate error, maintaining the Decode trait contract and
allowing applications to handle the error gracefully.

Signed-off-by: Jared Reyes <jaredreyespt@gmail.com>

* Fix formatting

Signed-off-by: Jared Reyes <jaredreyespt@gmail.com>

---------

Signed-off-by: Jared Reyes <jaredreyespt@gmail.com>
N
nohead committed
543d751b5e4ae53e16fce46720d8758e89600392
Parent: b3df1e5
Committed by GitHub <noreply@github.com> on 3/28/2026, 12:35:58 AM