diff options
author | Jose E. Marchesi <jose.marchesi@oracle.com> | 2024-02-19 20:39:48 +0100 |
---|---|---|
committer | Jose E. Marchesi <jose.marchesi@oracle.com> | 2024-02-19 20:48:17 +0100 |
commit | b86b514aace19799ea141514e16296fb63a089b3 (patch) | |
tree | d191bbb58f8dc18907d5014d7cd3689f68321672 /gas/ChangeLog | |
parent | b47cef7ca8a2fa55acdab367c87c1ea076aec4b2 (diff) | |
download | gdb-b86b514aace19799ea141514e16296fb63a089b3.zip gdb-b86b514aace19799ea141514e16296fb63a089b3.tar.gz gdb-b86b514aace19799ea141514e16296fb63a089b3.tar.bz2 |
bpf: gas: avoid UB in pointer subtraction
The PARSE_ERROR macro in md_assemble performs pointer subtraction. If
parse_expression returns NULL then the later will be part of the
subtraction and therefore UB will be incurred.
This patch changes md_assemble to:
1. Accommodate all invocations to parse_expression to the fact it will
return NULL when a parse error occurs.
2. Avoid UB in PARSE_ERROR.
Tested in bpf-unknown-none target / x86_64-linux-gnu host.
gas/ChangeLog:
* config/tc-bpf.c (md_assemble): Fix to take into account that
parse_expression can return NULL.
(PARSE_ERROR): Avoid passing invalid length to parse_error.
Diffstat (limited to 'gas/ChangeLog')
-rw-r--r-- | gas/ChangeLog | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 8be2991..3ae1d77 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2024-02-19 Jose E. Marchesi <jose.marchesi@oracle.com> + + * config/tc-bpf.c (md_assemble): Fix to take into account that + parse_expression can return NULL. + (PARSE_ERROR): Avoid passing invalid length to parse_error. + 2024-02-15 Will Hawkins <hawkinsw@obs.cr> * testsuite/gas/bpf/indcall-1-pseudoc.d: Do not select xbpf cpu |