Skip to content

Commit

Permalink
Merge pull request #348 from laytan/fix-use-after-free-in-fake-methods
Browse files Browse the repository at this point in the history
fix use after free in fake methods
  • Loading branch information
DanielGavin authored Apr 15, 2024
2 parents aa1aabd + 96ad8de commit 63758da
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/server/requests.odin
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,17 @@ notification_did_save :: proc(
for k2, v2 in &v.symbols {
if corrected_uri.uri == v2.uri {
free_symbol(v2, indexer.index.collection.allocator)
v.symbols[k2] = {}
delete_key(&v.symbols, k2)
}
}

for method, &symbols in v.methods {
for i := 0; i < len(symbols); i += 1 {
#no_bounds_check symbol := symbols[i]
if corrected_uri.uri == symbol.uri {
unordered_remove(&symbols, i)
i -= 1
}
}
}
}
Expand Down

0 comments on commit 63758da

Please sign in to comment.