[PATCH] gas: sframe: graceful handling of bogus sleb128 input
Jan Beulich
jbeulich@suse.com
Thu Jan 22 08:31:33 GMT 2026
On 22.01.2026 08:50, Indu Bhagat wrote:
> Currently, sframe_xlate_escape_sleb128_to_offsetT () uses a gas_assert
> to sanity check that a DWARF sleb128 value was successfully read from a
> single-byte buffer. However, if the byte provided has the highest bit
> set (e.g., bogus input of 0x80), the value of 'read' variable will be 0,
> triggering an assertion failure. This concern was raised during the
> review of SFrame-V3 patches
> https://inbox.sourceware.org/binutils/807b5641-87c2-4109-9d33-bb8fa28ed5ef@suse.com/T/#u
>
> Change the internal API sframe_xlate_escape_sleb128_to_offsetT () to return
> an error code. Callers now check for SFRAME_XLATE_ERR_INVAL and proceed
> to a warning/exit path rather than aborting.
>
> TBD:
> - With bogus input, say,
> # DW_CFA_def_cfa_expression, length, DW_OP_breg6, (sleb)offset, DW_OP_deref
> .cfi_escape 0xf,0x3,0x76,0x80,0x6
> GAS now says (after the patch):
> Warning: no SFrame FDE emitted; .cfi_escape with op (0xf)
> Not exactly very specific/helpful in the current context of bogus
> input, but thats what we have currently. I am
> not convinced that this needs a diagnostic of its own, so I am
> keeping the above behaviour. But others' opinion may differ. Discuss.
I think improvements here can be deferred until people actually run into
this and complain about insufficient hints from the diagnostic. After all
really no-one (except fuzzers) should be hitting this path. IOW - LGTM as
is.
Jan
More information about the Binutils
mailing list