[COMMITTED] libsframe: bugfix in flip_sframe

Indu Bhagat indu.bhagat@oracle.com
Wed Nov 26 05:04:08 GMT 2025


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.
---
 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;
-- 
2.43.0



More information about the Binutils mailing list