Commit 23d175e
committed
fix: Avoid potential panic in (i)NTT
To improve the performance of NTT, some internal data is cached. The key
for the cache is the log₂ of the input's length. Previously, the empty
input and an input of length 1 mapped to the same cache key. In case
NTT had
1. first been called on an empty input,
2. then called on input of length 1,
the cache would be incorrectly populated, leading to a panic.1 parent 27a6541 commit 23d175e
1 file changed
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
157 | 160 | | |
158 | 161 | | |
159 | 162 | | |
| |||
470 | 473 | | |
471 | 474 | | |
472 | 475 | | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
473 | 485 | | |
474 | 486 | | |
475 | 487 | | |
| |||
0 commit comments