[06/10] libsframe: check error condition in sframe_decode_fre
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
Commit Message
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(-)
Comments
On 8/28/2026 12:41 AM, Indu Bhagat wrote:
> 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(-)
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
> diff --git 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);
Regards,
Jens
@@ -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);