Pull up following revision(s) (requested by skrll in ticket #1567):
common/lib/libc/arch/arm/string/strlen_arm.S: revision 1.11 Fix strnlen with a large maxlen argument by using unsigned comparison conditions - from mlelstv. I had a similar, but not quite as good patch.
This commit is contained in:
parent
ebd40d45aa
commit
a50f46d018
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: strlen_arm.S,v 1.9 2014/05/06 16:02:11 joerg Exp $")
|
||||
RCSID("$NetBSD: strlen_arm.S,v 1.9.26.1 2023/01/19 10:37:03 martin Exp $")
|
||||
|
||||
#if defined(__thumb__) && !defined(_ARM_ARCH_T2)
|
||||
#error Only Thumb2 or ARM supported
|
||||
|
@ -102,7 +102,7 @@ ENTRY(FUNCNAME)
|
|||
.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 @@ ENTRY(FUNCNAME)
|
|||
#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 */
|
||||
|
|
Loading…
Reference in New Issue