diff options
author | Wilco Dijkstra <wilco.dijkstra@arm.com> | 2020-06-12 11:53:51 +0100 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2020-06-12 11:53:51 +0100 |
commit | d4f3f7f04e4234adf4c9eb2aaeedc4e1fefc8763 (patch) | |
tree | 2443127c63cffdb51f7ba2bd2ff0e5405d0fe0e9 /string | |
parent | f08b12e8085b6d0db039198e08af3898bb6e8598 (diff) | |
download | arm-optimized-routines-d4f3f7f04e4234adf4c9eb2aaeedc4e1fefc8763.tar.gz |
string: Fix overflow issue in strncmp-mte
If limit is near SIZE_MAX it can overflow in the mutually aligned path.
Fix this by clamping limit to SIZE_MAX.
Diffstat (limited to 'string')
-rw-r--r-- | string/aarch64/strncmp-mte.S | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/string/aarch64/strncmp-mte.S b/string/aarch64/strncmp-mte.S index b7e3914..46765d6 100644 --- a/string/aarch64/strncmp-mte.S +++ b/string/aarch64/strncmp-mte.S @@ -167,10 +167,10 @@ L(mutual_align): neg tmp3, count, lsl #3 /* 64 - bits(bytes beyond align). */ ldr data2, [src2], #8 mov tmp2, #~0 - and count, count, #0x3f LS_FW tmp2, tmp2, tmp3 /* Shift (count & 63). */ - /* Adjust the limit. Only low 3 bits used, so overflow irrelevant. */ - add limit, limit, count + /* Adjust the limit and ensure it doesn't overflow. */ + adds limit, limit, count + csinv limit, limit, xzr, lo orr data1, data1, tmp2 orr data2, data2, tmp2 b L(start_realigned) |