[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ptrdiff_t overflow checks for malloc-posix etc.

From: Paul Eggert
Subject: Re: ptrdiff_t overflow checks for malloc-posix etc.
Date: Sun, 18 Apr 2021 12:47:00 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 4/18/21 5:13 AM, Bruno Haible wrote:
How about extending the unit test (tests/test-malloc-gnu.c) accordingly?

Won't that raise the possibility of the tests being too expensive, in case the C library actually attempts to allocate PTRDIFF_MAX + 1 bytes? (I'm looking at you, 64-bit Hurd. :-)

I see we're already doing something similar with size_t in test-reallocarray.c but I suspect that test isn't often run because reallocarray isn't much used yet. Plus, that test won't use up much resources even on typical buggy hosts, because size_t overflow wraps around.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]