[all-commits] [llvm/llvm-project] f92d31: [mlir] Fixed double-free bug in SymbolUserMap

Nandor Licker via All-commits all-commits at lists.llvm.org
Fri Jul 8 10:07:05 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f92d319c70b5893deb33a996af4b5a74e193d66b
      https://github.com/llvm/llvm-project/commit/f92d319c70b5893deb33a996af4b5a74e193d66b
  Author: Nandor Licker <n at ndor.email>
  Date:   2022-07-08 (Fri, 08 Jul 2022)

  Changed paths:
    M mlir/lib/IR/SymbolTable.cpp

  Log Message:
  -----------
  [mlir] Fixed double-free bug in SymbolUserMap

`SymbolUserMap` relied on `try_emplace` and `std::move` to relocate an entry to another key.  However, if this triggered the resizing of the `DenseMap`, the value was destroyed before it could be moved to the new storage location, leading to a dangling `users` reference to be inserted into the map. On destruction, since a new entry was created from one that was already freed, a double-free error occurred.

Fixed issue by re-fetching the iterator after the mutation of the container.

Differential Revision: https://reviews.llvm.org/D129345




More information about the All-commits mailing list