[Mlir-commits] [mlir] [mlir][bytecode] Fix crash when reading DenseIntOrFPElementsAttr with unsupported element type (PR #184773)
Matthias Springer
llvmlistbot at llvm.org
Thu Mar 5 03:30:06 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 "
----------------
matthias-springer wrote:
Or you wrote the bytecode by hand and then tried to read it.
https://github.com/llvm/llvm-project/pull/184773
More information about the Mlir-commits
mailing list