[Mlir-commits] [mlir] 72af0bf - Memory corruption issure for DenseStringElementsAttr

River Riddle llvmlistbot at llvm.org
Sat Apr 25 01:26:45 PDT 2020


Author: Rob Suderman
Date: 2020-04-25T01:23:43-07:00
New Revision: 72af0bf1760919adb2b08b9eed0ca05e1e45a6d5

URL: https://github.com/llvm/llvm-project/commit/72af0bf1760919adb2b08b9eed0ca05e1e45a6d5
DIFF: https://github.com/llvm/llvm-project/commit/72af0bf1760919adb2b08b9eed0ca05e1e45a6d5.diff

LOG: Memory corruption issure for DenseStringElementsAttr

Summary: There was a memory corruption issue where the lifespan of the ArrayRef<StringRef> would fail. Directly passing the data will avoid the issue.

Reviewers: rriddle

Reviewed By: rriddle

Subscribers: mehdi_amini, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm

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

Added: 
    

Modified: 
    mlir/lib/IR/AttributeDetail.h

Removed: 
    


################################################################################
diff  --git a/mlir/lib/IR/AttributeDetail.h b/mlir/lib/IR/AttributeDetail.h
index 93829aed90b6..011f4d7650f4 100644
--- a/mlir/lib/IR/AttributeDetail.h
+++ b/mlir/lib/IR/AttributeDetail.h
@@ -610,8 +610,8 @@ struct DenseStringElementsAttributeStorage
       if (!firstElt.equals(data[i]))
         return KeyTy(ty, data, llvm::hash_combine(hashVal, data.drop_front(i)));
 
-    // Otherwise, this is a splat so just return the hash of the first element.
-    return KeyTy(ty, {firstElt}, hashVal, /*isSplat=*/true);
+    // Otherwise, this is a splat.
+    return KeyTy(ty, data, hashVal, /*isSplat=*/true);
   }
 
   /// Hash the key for the storage.


        


More information about the Mlir-commits mailing list