Commit 785d73d
Avoid use-after-free aborting a failed mdb_txn_commit in DiskCache. (#227)
put_raw! and delete_batch! had a finally block that called mdb_txn_abort
whenever the commit hadn't reached the `committed = true` line. But
mdb_txn_commit frees the txn handle on both success and failure (per
lmdb.h), so when check() threw on a non-zero status the finally aborted
an already-freed pointer. Mark the txn as handed off immediately after
the commit ccall returns, before letting check() throw.
Same bug pattern as JuliaLang/julia#61527 commit 71db484e.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f8f3b21 commit 785d73d
1 file changed
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
| 407 | + | |
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | | - | |
419 | | - | |
420 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
421 | 424 | | |
422 | | - | |
| 425 | + | |
423 | 426 | | |
424 | 427 | | |
425 | 428 | | |
| |||
547 | 550 | | |
548 | 551 | | |
549 | 552 | | |
550 | | - | |
| 553 | + | |
551 | 554 | | |
552 | 555 | | |
553 | 556 | | |
| |||
563 | 566 | | |
564 | 567 | | |
565 | 568 | | |
566 | | - | |
567 | | - | |
568 | | - | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
569 | 575 | | |
570 | | - | |
| 576 | + | |
571 | 577 | | |
572 | 578 | | |
573 | 579 | | |
| |||
0 commit comments