From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_MSPIKE_H2, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13645 invoked from network); 6 Sep 2022 12:13:33 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 6 Sep 2022 12:13:33 -0000 Received: (qmail 15980 invoked by uid 550); 6 Sep 2022 12:13:27 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 15948 invoked from network); 6 Sep 2022 12:13:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zhasha.com; s=wirbelwind; t=1662466391; bh=yYYmn9lR5u4aYGoB/51FoQb4R2sqJeeHXWHKe9I8vGI=; h=Date:From:To:Subject:In-Reply-To:References; b=UUatCSANcIbib2cwn+kVjhJ3zS4kQKwGojW47ehQijFbN5y6DvSMo2OsIqGCiFxG9 0p7pYiS2eOEiW7A6+N7n69uzl7CYnqsVngYKqLg0c7XRWXh5AQY/WCLRtJ51uIHBxv MGZbtmsS8XXmkauyu3Pai5/TZlZ+KhDj4AWCaHNY= Date: Tue, 6 Sep 2022 14:13:11 +0200 From: Joakim Sindholt To: musl@lists.openwall.com Message-Id: <20220906141311.b8650027f3499c080f45b4fd@zhasha.com> In-Reply-To: <6c1dfc63-b3e8-46a3-1db1-4d5bdf031086@gmail.com> References: <7bf9a30d-4ba8-1fe7-8c80-db99446db307@gmail.com> <6c1dfc63-b3e8-46a3-1db1-4d5bdf031086@gmail.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [musl] ecvt(0, 0, ...) is broken On Tue, 6 Sep 2022 12:12:48 +0200, Gabriel Ravier wrote: > Executing ecvt(0, 0, &decpt, &sign) results in musl returning > "000000000000000". > > This seems highly likely to be a bug considering that glibc returns "" > and I see no plausible reasoning for musl's behavior that could be > justified by the standard. POSIX.1-2001 said: > The ecvt() function shall convert value to a null-terminated string of > ndigit digits (where ndigit is reduced to an unspecified limit > determined by the precision of a double) and return a pointer to the > string. The high-order digit shall be non-zero, unless the value is 0. The first part would imply that ndigit=0 should return the string "" but the second part makes no provision for a zero-digit-long string. I would say ndigit=0 is UB.