From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 76B2E384A044; Wed, 15 Apr 2020 14:13:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76B2E384A044 From: "zhuyan34 at huawei dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/25824] Abnormal function of strnlen in aarch64 Date: Wed, 15 Apr 2020 14:13:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.31 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zhuyan34 at huawei dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2020 14:13:24 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D25824 --- Comment #2 from Yan Zhu --- There is a testcase. #include #include void init_base(char *base, int len) { int i; for (i =3D 0; i < len; i++) { base[i] =3D 'x'; } base[len] =3D '\0'; } int main(int argc, char *argv[]) { int i; char base[1000]; char buff[1000]; size_t n; for (i =3D 1; i < 1000; i++) { memset(buff, 0, 1000); init_base(base, i);=20=20=20=20=20=20=20=20=20=20=20=20=20 n =3D strnlen(base, 1000);=20=20=20=20=20=20 if ( i =3D=3D n ) printf("size=3D%d is equel\n", i); else printf("size=3D%d is not equel%s\n", i); } return 0; } The execution log is as follows=EF=BC=9A arm64be /tmp # ./arm64be-test_strnlen size=3D1 is equel size=3D2 is equel size=3D3 is equel size=3D4 is equel size=3D5 is equel size=3D6 is equel size=3D7 is equel size=3D8 is equel size=3D9 is not equel size=3D10 is not equel size=3D11 is not equel size=3D12 is not equel size=3D13 is not equel --=20 You are receiving this mail because: You are on the CC list for the bug.=