Commit 3da2230
committed
fix: use resize instead of reserve in batch_invert to fix UB
batch_invert used reserve() for its temporaries and skipped vectors,
then accessed elements via operator[]. reserve() only allocates capacity
without changing size, making operator[] access undefined behavior.
This crashes in debug builds with _GLIBCXX_ASSERTIONS enabled.
Fixed by using direct size-construction: vector(n) instead of
reserve(n).1 parent cf1a239 commit 3da2230
1 file changed
+2
-4
lines changedLines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
| 422 | + | |
| 423 | + | |
426 | 424 | | |
427 | 425 | | |
428 | 426 | | |
| |||
0 commit comments