Commit 79ecd1f
committed
ESIGN: use .data() to preserve bounds for Fortify/Clang; add defensive assert
Fortify/Clang emits false positive in InvertibleESIGNFunction::GenerateRandom
because pointer arithmetic on SecByteBlock after implicit conversion to byte*
loses destination object's size info.
- Change seed + 4 to seed.data() + 4 to preserve bounds for static analyzers
- Add CRYPTOPP_ASSERT to document invariant (compiles to no-op in release)
- No behavior change: buffer is resized, then seedParam.size() bytes copied at offset +4
The .data() method avoids analyzer losing track of object size after pointer arithmetic.
Assert documents intended invariant and helps static analysis tools.1 parent 2e1e872 commit 79ecd1f
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| |||
0 commit comments