[PATCH] sframe: fix PR libsframe/33051

Jens Remus jremus@linux.ibm.com
Wed Jun 4 07:05:40 GMT 2025


On 04.06.2025 05:22, Indu Bhagat via Binutils wrote:
> Fix PR libsframe/Bug 33051 - ASAN: heap-buffer-overflow
> ../../src/libsframe/sframe.c:1054 in
> sframe_get_funcdesc_with_addr_internal
> 
> The previous commit 9d2a24349e2 (libsframe: correct binary search for
> SFrame FDE) adapted the binary search logic in
> sframe_get_funcdesc_with_addr_internal.  Adjusting the upper end of the
> search index was missed.
> 
> The search must only be done for FDEs starting at index 0 and up until
> num_fdes - 1.  Prior logic of searching (before commit 9d2a24349e2) was
> a bit different.
> 
> libsframe/
> 	* sframe.c: Use the correct high index.
> ---

Ouch, thanks for fixing!  I missed that.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>

>  libsframe/sframe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libsframe/sframe.c b/libsframe/sframe.c
> index 950a6846f04..d38a61dbd63 100644
> --- a/libsframe/sframe.c
> +++ b/libsframe/sframe.c
> @@ -1044,7 +1044,7 @@ sframe_get_funcdesc_with_addr_internal (sframe_decoder_ctx *ctx, int32_t addr,
>    /* Do the binary search.  */
>    fdp = (sframe_func_desc_entry *) ctx->sfd_funcdesc;
>    low = 0;
> -  high = dhp->sfh_num_fdes;
> +  high = dhp->sfh_num_fdes - 1;
>    while (low <= high)
>      {
>        int mid = low + (high - low) / 2;

Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com

IBM

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/



More information about the Binutils mailing list