Commit 543d751
authored
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>1 parent b3df1e5 commit 543d751
1 file changed
+6
-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 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
0 commit comments