From nobody Sun Feb 19 17:14:00 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 4PKXG01pvVz3rSLN for ; Sun, 19 Feb 2023 17:14:00 +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 4PKXG00r4wz3hTX for ; Sun, 19 Feb 2023 17:14:00 +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=1676826840; 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: in-reply-to:in-reply-to:references:references; bh=F/3U6iHmX1ulHFbEaWYIyC/BZYrwT7xm2hH/oXFLsf4=; b=re3OwEnfWiHIpHTo6K3EGwJT6jHE/9cosop/czAgmF4BxBDyxoHrNCKSGxxkyRotc1HKp4 qJPa9GDTR/CHxXREsIA1PE9hPuwj/PeMj9TtDjnyZetpN905vUHWOsaxNyHJPSoDkqroxT NZVyrs+4a7n3jrKfEiGYjyqE3JObUcNuMop4DggR+13a2pPU6jQWC6WIEdd9mEa2Klyrvx IbsTSNZK6nxj4HxX/tyysu7C0oF2DH/osMn9T7UbJ2UvMzlmVZo00uPELegkTB7hLX08TX AB7z8abzhh0YwmByAD8rJDDZ1cIU59yNouAZn1ceSVwCSqmKD7nm/b5vCKIFag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676826840; a=rsa-sha256; cv=none; b=SFVLUJetdULzXtuTn1jVfE1D38YJ6dYFpLK9ncUOU0PIggiT6OSur8epQlsxxc1MZ+qQzZ 086753Rz7o8uxL87wAUJKeyjVfJqx5eyyaZVRN7+13GsBN4la1oVaTk1qB/If0nXXs3Wst nWf92otpYVMym0If4wy6g1NERzYfoM8aHd/misZyUf9aZvQtqtbLfcKIQXJm1ZSG2f0EXm xbzuoZm848twnUSICj10dGfFhSfymTnz7e4JIkd45sE3Le0jQPrm/e6mFIUitVoeWz3hwd /PNJKbYqTXavN8//oL7xk7Xxm/g/mfG82VritZKBWeXAgF5tQtrg0TcIIloYtg== 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 4PKXFz72Vwz18S7 for ; Sun, 19 Feb 2023 17:13:59 +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 31JHDxJL017769 for ; Sun, 19 Feb 2023 17:13:59 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 31JHDxsr017768 for bugs@FreeBSD.org; Sun, 19 Feb 2023 17:13:59 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 269688] memalign() produces division by zero if size is 0 Date: Sun, 19 Feb 2023 17:14:00 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: pjfloyd@wanadoo.fr X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org 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: 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=3D269688 --- Comment #2 from Paul Floyd --- On other platforms the behaviour is: macOS doesn't exist Linux glibc just calls malloc https://elixir.bootlin.com/glibc/glibc-2.37.9000/source/malloc/malloc.c#L35= 10 /* If we need less alignment than we give anyway, just relay to malloc. = */ if (alignment <=3D MALLOC_ALIGNMENT) return __libc_malloc (bytes); musl just calls malloc https://github.com/esmil/musl/blob/master/src/malloc/memalign.c if (align <=3D 4*sizeof(size_t)) { if (!(mem =3D malloc(len))) return NULL; return mem; } illimos sets EINVAL and returns NULL https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libc/port/g= en/memalign.c /* * check for valid size and alignment parameters * MAX_ALIGN check prevents overflow in later calculation. */ if (nbytes =3D=3D 0 || _misaligned(align) || align =3D=3D 0 || align > MAX_ALIGN) { errno =3D EINVAL; return (NULL); } --=20 You are receiving this mail because: You are the assignee for the bug.=