Summary
A malformed LiteralProto can trigger a heap buffer overflow during XLA literal materialization when a tuple-contained leaf array retains a custom non-zero layout.element_size_in_bits value.
Root cause
Literal::SetShape canonicalized custom element sizes only for root array shapes, but not for tuple-contained leaf arrays. This allowed an inconsistent state where:
- buffer sizing honored the custom bit width, while
- typed literal population assumed a dense native representation.
Security impact
This can lead to a heap out-of-bounds write during LiteralProto ingestion/materialization.
Proposed fix
PR: #40838
Summary
A malformed
LiteralProtocan trigger a heap buffer overflow during XLA literal materialization when a tuple-contained leaf array retains a custom non-zerolayout.element_size_in_bitsvalue.Root cause
Literal::SetShapecanonicalized custom element sizes only for root array shapes, but not for tuple-contained leaf arrays. This allowed an inconsistent state where:Security impact
This can lead to a heap out-of-bounds write during
LiteralProtoingestion/materialization.Proposed fix
PR: #40838