Commit fbe37b6
Harden BLS weighted-sum/pairing length validation and QC pending-bitset checks
Two robustness fixes in the Savanna consensus path, found during a security review.
crypto.cpp: bls_g1_weighted_sum / bls_g2_weighted_sum / bls_pairing validated the
element-count-derived span lengths using 32-bit arithmetic, which can overflow for
large element counts and let malformed inputs pass the size check before allocation.
Compute the expected span lengths in 64-bit so the comparison is exact and malformed
calls stay on the return_code::failure path.
qc.cpp: validate the pending finalizer-policy signature's vote format and weights
before comparing dual-policy finalizer votes, and replace the debug-only assert()s in
qc_sig_t::vote_same_at() (compiled out under NDEBUG) with runtime EOS_ASSERT bounds
checks on both signatures' vote indices, so a malformed pending vote bitset is rejected
rather than reaching unchecked dynamic_bitset indexing.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent fcb9f5f commit fbe37b6
2 files changed
Lines changed: 22 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| |||
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
87 | | - | |
88 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
89 | 98 | | |
90 | 99 | | |
91 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
289 | 292 | | |
290 | 293 | | |
291 | 294 | | |
| |||
320 | 323 | | |
321 | 324 | | |
322 | 325 | | |
323 | | - | |
| 326 | + | |
| 327 | + | |
324 | 328 | | |
325 | 329 | | |
326 | 330 | | |
| |||
355 | 359 | | |
356 | 360 | | |
357 | 361 | | |
358 | | - | |
| 362 | + | |
| 363 | + | |
359 | 364 | | |
360 | 365 | | |
361 | 366 | | |
| |||
0 commit comments