From nobody Wed Jul 12 18:29:29 2023 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4R1R962C7Fz4mtHF for ; Wed, 12 Jul 2023 18:29:30 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R1R961DZ0z4c8R for ; Wed, 12 Jul 2023 18:29:30 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689186570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xdEcvFcdSNAg2HXAt4nCJS6nIYKD57sI/JP3/ONdXSE=; b=dNdm0jwLdP27yXIC+PknXPw3bgifIPHEFoF+uOVZyrTvhdg568Qz+OLApkJDVywP0BpJOs vuDJhNxwy1eulpg4UqxKe8zDl45bR2dNetOBJhqy/qukWt+JvQXXVfNeVKFBrHQfdq08Vb +cyyWzEd+giLt0mUPBZS+Dk1Tx64Q9jwrrCSLJB7OQc4aDKQT+zRj8/OP0Par//gNZzsjU L5Y5G/CQzILSsNuqM3vT42xmfbQ5ICXP1cqLbmoEooOx0xR0BmGe9T5zvipsZ3u6Tzt0yA xTuQfmdrxcQrHEY9FP+L4Z/GWhRW+Gh0df45QJ6ZThNAncDgaXt8GsuuxLLtAg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689186570; a=rsa-sha256; cv=none; b=BqzlSjReWPN1m4v119idHoQaP6N+vNGw/KXzFHNsV6IZXFm+hBTuAXAZs2C+e8uOJ6KFBS 3w6jBilkQn1eYCzE32E38rQWDeDtjXb2UJ1894utpWDqsO28zeItGF8muJGFCIaIRLX1Is mC9AYNIsrAd7VtDKkyCRQagLx+/JeaMF/j6aZixb2QmrcVF1FaaLqtQ9ZjE2g8onA5EZYv SoW0GIAZza/7a69L9xvPeCUF7i/gIh9PRediXvD91Zm5gdC41vFn4e+x7PCt0M1998P/Ar V8Aao3vAvII5ZMwlbyep9Jlxk+QvVws/Wwts/uD7e4Q1Mm95KFb2/67GDjGKJA== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4R1R960BSCzKB9 for ; Wed, 12 Jul 2023 18:29:30 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 36CITTub042225 for ; Wed, 12 Jul 2023 18:29:29 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 36CITTMg042224 for bugs@FreeBSD.org; Wed, 12 Jul 2023 18:29:29 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 272474] lib/libc: bcmp may give wrong results on LP64 systems Date: Wed, 12 Jul 2023 18:29:29 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: fuz@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: mfc-stable13? mfc-stable12? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter flagtypes.name attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272474 Bug ID: 272474 Summary: lib/libc: bcmp may give wrong results on LP64 systems Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: fuz@FreeBSD.org Flags: mfc-stable13?, mfc-stable12? Created attachment 243358 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D243358&action= =3Dedit fix bcmp() bug bcmp() returns the number of remaining bytes when the main loop exits. In case of a match, this is zero, else a positive integer. On systems where SIZE_MAX > INT_MAX, the implicit conversion from size_t to int in the return value may cause the number of remaining bytes to overflow, becoming zero and falsely indicating a successful comparison. This bug affects any 64 bit system that doesn't have a machdep implementati= on of bcmp(). This should be all except amd64. OpenBSD has the same implementation and is likely affected, too. The bug has presumably been present since ancient times. The attached patch fixes the bug by always returning 0 on equality, 1 otherwise. --=20 You are receiving this mail because: You are the assignee for the bug.=