[Mlir-commits] [mlir] [mlir][bytecode] Fix crash when reading DenseIntOrFPElementsAttr with unsupported element type (PR #184773)
Jacques Pienaar
llvmlistbot at llvm.org
Thu Mar 5 03:28:12 PST 2026
================
@@ -151,6 +151,17 @@ static void writeFileLineColRangeLocs(DialectBytecodeWriter &writer,
static LogicalResult
readDenseIntOrFPElementsAttr(DialectBytecodeReader &reader, ShapedType type,
SmallVectorImpl<char> &rawData) {
+ // Validate that the element type implements DenseElementTypeInterface.
+ // Without this check, downstream code unconditionally calls
+ // getDenseElementBitWidth() which asserts on unsupported types.
+ if (!llvm::isa<DenseElementType>(type.getElementType())) {
+ reader.emitError()
+ << "DenseIntOrFPElementsAttr element type must implement "
----------------
jpienaar wrote:
So this is only possible if one had invalid IR, serialized it and then read this?
https://github.com/llvm/llvm-project/pull/184773
More information about the Mlir-commits
mailing list