[PATCH 06/10] libsframe: check error condition in sframe_decode_fre

Indu Bhagat <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
The sframe_decode_fre_start_address API returns SFRAME_ERR in case of
invalid fre_type.  Check for return value and exit early.
---
 libsframe/sframe.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libsframe/sframe.c b/libsframe/sframe.c
index 51b6bf57c05..288d7c0d873 100644
--- a/libsframe/sframe.c
+++ b/libsframe/sframe.c
@@ -1408,7 +1408,9 @@ sframe_decode_fre (const char *fre_buf, sframe_frame_row_entry *fre,
     return sframe_set_errno (&err, SFRAME_ERR_INVAL);
 
   /* Copy over the FRE start address.  */
-  sframe_decode_fre_start_address (fre_buf, &fre->fre_start_addr, fre_type);
+  if (sframe_decode_fre_start_address (fre_buf, &fre->fre_start_addr,
+				       fre_type))
+    return sframe_set_errno (&err, SFRAME_ERR_INVAL);
 
   addr_size = sframe_fre_start_addr_size (fre_type);
   fre->fre_info = *(uint8_t *)(fre_buf + addr_size);
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.