[Bug libc/25824] Abnormal function of strnlen in aarch64
zhuyan34 at huawei dot com
sourceware-bugzilla@sourceware.org
Wed Apr 15 14:13:44 GMT 2020
https://sourceware.org/bugzilla/show_bug.cgi?id=25824
--- Comment #3 from Yan Zhu <zhuyan34 at huawei dot com> ---
There is a testcase.
#include <stdio.h>
#include <string.h>
void init_base(char *base, int len)
{
int i;
for (i = 0; i < len; i++) {
base[i] = 'x';
}
base[len] = '\0';
}
int main(int argc, char *argv[])
{
int i;
char base[1000];
char buff[1000];
size_t n;
for (i = 1; i < 1000; i++) {
memset(buff, 0, 1000);
init_base(base, i);
n = strnlen(base, 1000);
if ( i == n )
printf("size=%d is equel\n", i);
else
printf("size=%d is not equel%s\n", i);
}
return 0;
}
The execution log is as follows:
arm64be /tmp # ./arm64be-test_strnlen
size=1 is equel
size=2 is equel
size=3 is equel
size=4 is equel
size=5 is equel
size=6 is equel
size=7 is equel
size=8 is equel
size=9 is not equel
size=10 is not equel
size=11 is not equel
size=12 is not equel
size=13 is not equel
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list