[binutils-gdb] libsframe: bugfix in flip_sframe

Indu Bhagat ibhagat@sourceware.org
Wed Nov 26 04:58:02 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a806da18ad55c99cc4bb8f609015c39ab27d0b02

commit a806da18ad55c99cc4bb8f609015c39ab27d0b02
Author: Indu Bhagat <indu.bhagat@oracle.com>
Date:   Tue Nov 25 20:46:08 2025 -0800

    libsframe: bugfix in flip_sframe
    
    A previous commit bdb0d62281a to make flip_fde version aware added a new
    argument for passing the remaning buffer size to the involved functions.
    Fix the passed value to the intended.
    
    libsframe/
            * sframe.c (flip_sframe): Correct the passed value of buf size.

Diff:
---
 libsframe/sframe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libsframe/sframe.c b/libsframe/sframe.c
index 303ab077564..0dcc782b1f6 100644
--- a/libsframe/sframe.c
+++ b/libsframe/sframe.c
@@ -628,7 +628,7 @@ flip_sframe (char *frame_buf, size_t buf_size, uint32_t to_foreign)
       if (fdes >= buf_end)
 	goto bad;
 
-      if (to_foreign && sframe_decode_fde (fdes, fdes - buf_end, ver,
+      if (to_foreign && sframe_decode_fde (fdes, buf_end - fdes, ver,
 					   &num_fres, &fre_type, &fre_offset,
 					   &fsz))
 	goto bad;
@@ -638,7 +638,7 @@ flip_sframe (char *frame_buf, size_t buf_size, uint32_t to_foreign)
 
       fde_bytes_flipped += fsz;
 
-      if (!to_foreign && sframe_decode_fde (fdes, fdes - buf_end, ver,
+      if (!to_foreign && sframe_decode_fde (fdes, buf_end - fdes, ver,
 					    &num_fres, &fre_type, &fre_offset,
 					    &fsz))
 	goto bad;


More information about the Binutils-cvs mailing list