Commit b7b2b72
committed
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>1 parent 7248f64 commit b7b2b72
1 file changed
+8
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
| |||
0 commit comments