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

Mehdi Amini llvmlistbot at llvm.org
Tue Oct 17 14:14:43 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 = {};
----------------
joker-eph wrote:

> if shape is not empty then it's consistent with storage,
> if shape is empty then it's inconsistent with storage and one should be using the latter instead.

This statement as-is is just leading me to question: what is the purpose of the "shape" field in the first place? As described here it is just redundant with the storage.

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


More information about the Mlir-commits mailing list