Date: Thu, 14 Jan 2016 17:17:11 -0500 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: Possible infinite loop in qsort() On Tue, Jan 12, 2016 at 03:25:57PM +0300, Alexander Cherepanov wrote: > On 2016-01-10 14:38, Markus Wichmann wrote: > >On Sat, Jan 09, 2016 at 11:05:16PM -0500, Rich Felker wrote: > >>On Sat, Jan 09, 2016 at 10:07:19AM +0100, Felix Janda wrote: > >>>musl enforces that object sizes should not be greater than PTRDIFF_MAX. > >>>See for example the discussion at > >>> > >>>http://www.openwall.com/lists/musl/2013/06/27/7 > >>> > >>>So there will not be objects of size 3GB with musl on x32. Since the > >>>Leonardo numbers grow slower than 2^n in general no overflow should > >>>happen if "size" is valid. Otherwise, UB was invoked. > >> > > > >OK. Might want to make that assumption a bit more prominent, because > >this is the first time I've ever heard about it, but OK, no objects >2GB > >on 32-bit archs. > > Yeah, I don't see it in the doc. Did I miss it? The documentation is incomplete; in particular, the part that would cover things like this has not been written at all and exists just in my head (and to a lesser extent as implied from commit messages and mailing list threads). :-) > If it neither works nor documented as a limit I'd call it a bug. An implementation is under no obligation to document the conditions under which it's "out of memory" (ENOMEM). These are usually complex and highly implementation specific. > BTW the support in compilers for working with objects larger than > half the address space is buggy -- see > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67999 . The same > situation -- it neither works nor documented. Somewhat puzzling... The only bug here is that it's not documented. "Supporting" such objects without making ptrdiff_t a 64-bit type is an intolerably bad QoI issue. Rich
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.