[Mlir-commits] [mlir] [mlir] Fix use-after-free bugs in {RankedTensorType|VectorType}::Builder (PR #68969)

Benjamin Maxwell llvmlistbot at llvm.org
Tue Oct 17 14:24:41 PDT 2023


================
@@ -277,7 +277,7 @@ class RankedTensorType::Builder {
     if (storage.empty())
       storage.append(shape.begin(), shape.end());
     storage.erase(storage.begin() + pos);
-    shape = {storage.data(), storage.size()};
+    shape = {};
----------------
MacDue wrote:

The builders are copy-on-write (this PR does not change that). The shape is only copied (from the input `ArrayRef`, a pointer to some other storage) on modification (of the shape).

https://github.com/llvm/llvm-project/pull/68969


More information about the Mlir-commits mailing list