AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 61 Bitcoin

map: fix incorrect clear when reinserting an integer after removing bytes

Public commit record

What the developer wrote

Authored by Jon Griffiths

73/100 · Adequate
map: fix incorrect clear when reinserting an integer after removing bytes

Reported-by: Jordan Mecom (@jmecom) via https://github.com/jmecom/odo
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a bug in a key-value map used by the libwally-core crypto library. When a caller removed a byte-keyed entry and then reinserted a new integer-keyed entry into the same slot, the code could mistakenly free or overwrite memory that was no longer valid. The fix ensures integer keys are explicitly set to 'no bytes' and null values are handled cleanly, preventing memory corruption.

Recommended action

Review callers of wally_map_add_integer and wally_map_add that remove and reinsert entries to confirm no other stale-field assumptions exist; run the new regression test under ASan/Valgrind; consider auditing map_remove and map_find for similar uninitialized/stale-field issues.

Security signals we found

01

memory corruption risk: stale pointer dereference/clear_and_free_bytes on reused map slot

02

potential double-free/use-after-free when reusing a removed item's key pointer

03

regression test added for remove-then-reinsert-integer scenario

04

Reported-by line credits external reporter Jordan Mecom

Risk score

Why this scored 61/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 10/15
Affected reach 10/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.