Skip to content

Commit

Permalink
Remove previous heuristic for UAF warning in multi-threaded case
Browse files Browse the repository at this point in the history
  • Loading branch information
mrstanb committed Jul 15, 2023
1 parent af4bb79 commit 8f295ee
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/analyses/useAfterFree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ struct
let get_current_threadid ctx =
ctx.ask Queries.CurrentThreadId

let warn_for_multi_threaded ctx behavior cwe_number =
if not (ctx.ask (Queries.MustBeSingleThreaded { since_start = true })) then
M.warn ~category:(Behavior behavior) ~tags:[CWE cwe_number] "Program isn't running in single-threaded mode. Use-After-Free might occur due to multi-threading"

let warn_for_multi_threaded_access ctx (heap_var:varinfo) behavior cwe_number =
let freeing_threads = ctx.global heap_var in
(* If we're single-threaded or there are no threads freeing the memory, we have nothing to WARN about *)
Expand Down Expand Up @@ -74,7 +70,6 @@ struct
let state = ctx.local in
let undefined_behavior = if is_double_free then Undefined DoubleFree else Undefined UseAfterFree in
let cwe_number = if is_double_free then 415 else 416 in
warn_for_multi_threaded ctx undefined_behavior cwe_number; (* Simple solution to warn when multi-threaded *)
let rec offset_might_contain_freed offset =
match offset with
| NoOffset -> ()
Expand Down

0 comments on commit 8f295ee

Please sign in to comment.