Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <03692d47-88c1-3246-f599-713f5bf51cf7@redhat.com>
Date: Mon, 16 Jun 2025 23:39:48 +0000 (UTC)
From: Joseph Myers <josmyers@...hat.com>
To: Alejandro Colomar <alx@...nel.org>
cc: Florian Weimer <fweimer@...hat.com>, 
    Adhemerval Zanella Netto <adhemerval.zanella@...aro.org>, 
    musl@...ts.openwall.com, libc-alpha@...rceware.org, 
    наб <nabijaczleweli@...ijaczleweli.xyz>, 
    Paul Eggert <eggert@...ucla.edu>, Robert Seacord <rcseacord@...il.com>, 
    Elliott Hughes <enh@...gle.com>, Bruno Haible <bruno@...sp.org>, 
    bug-gnulib@....org, JeanHeyd Meneide <phdofthehouse@...il.com>
Subject: Re: BUG: realloc(p,0) should be consistent with malloc(0)

On Mon, 16 Jun 2025, Alejandro Colomar wrote:

> Since glibc and Bionic are the two implementations that are currently
> broken, could you please fix your implementations?  I'm sure the
> C Committee will be much easier to convince if the implentations have
> changed in a clear direction.
> 
> But if the committee says we're not fixing ISO C until the
> implementations are fixed, and the implementations (you) refuse to
> accept the fix until the committee standardizes something, then we'll
> have the problem forever.

I think a better way to eliminate UB here would be to require this 
erroneous case to terminate execution.  The sequence of changes to 
semantics in past standard versions means that it's always a bad idea for 
applications to try to use realloc with size 0 and preventing them more 
strongly from doing so seems better to me than defining semantics that an 
application might then be able to use in 10-15 years' time.

-- 
Joseph S. Myers
josmyers@...hat.com

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.