Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libc/arch/arm/string Fix strnlen with a large max...
details: https://anonhg.NetBSD.org/src/rev/786c2db60be7
branches: trunk
changeset: 373054:786c2db60be7
user: skrll <skrll%NetBSD.org@localhost>
date: Sun Jan 15 08:43:03 2023 +0000
description:
Fix strnlen with a large maxlen argument by using unsigned comparison
conditions - from mlelstv.
I had a similar, but not quite as good patch.
diffstat:
common/lib/libc/arch/arm/string/strlen_arm.S | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (33 lines):
diff -r a4c16e6be61a -r 786c2db60be7 common/lib/libc/arch/arm/string/strlen_arm.S
--- a/common/lib/libc/arch/arm/string/strlen_arm.S Sun Jan 15 06:19:45 2023 +0000
+++ b/common/lib/libc/arch/arm/string/strlen_arm.S Sun Jan 15 08:43:03 2023 +0000
@@ -29,7 +29,7 @@
#include <machine/asm.h>
-RCSID("$NetBSD: strlen_arm.S,v 1.10 2022/12/03 11:34:38 skrll Exp $")
+RCSID("$NetBSD: strlen_arm.S,v 1.11 2023/01/15 08:43:03 skrll Exp $")
#if defined(__thumb__) && !defined(_ARM_ARCH_T2)
#error Only Thumb2 or ARM supported
@@ -102,7 +102,7 @@
.Lmain_loop:
#ifdef STRNLEN
cmp r0, r5 /* gone too far? */
- bge .Lmaxed_out /* yes, return maxlen */
+ bhs .Lmaxed_out /* yes, return maxlen */
#endif
ldr r3, [r0], #4 /* load next word */
#if defined(_ARM_ARCH_6)
@@ -164,9 +164,9 @@
#ifdef STRNLEN
cmp r0, r4 /* is it larger than maxlen? */
#ifdef __thumb__
- it gt
+ it hi
#endif
- movgt r0, r4 /* yes, return maxlen */
+ movhi r0, r4 /* yes, return maxlen */
pop {r4, r5} /* restore registers */
#endif
RET /* return */
Home |
Main Index |
Thread Index |
Old Index