Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcperciva import #352

Merged
merged 3 commits into from
Apr 26, 2022
Merged

libcperciva import #352

merged 3 commits into from
Apr 26, 2022

Conversation

gperciva
Copy link
Member

No description provided.

- Having a fixed response for malloc(0) eliminates a source of
  implementation-defined behaviour.

- Returning NULL in response to a request for zero bytes was already
  allowed by the standard, although it is (to quote the FreeBSD man
  page) "a silly response to a silly question".

- Explicitly returning NULL in this case makes it easier for static
  analysis tools to recognize that NULL is possible and may help them to
  find more bugs.
If n is SIZE_MAX, then n+1 (used in the following IMALLOC) will overflow.

Reported by:	gcc -fanalyzer
This commit does not modify external/queue/queue.h.  That file has
1 instance of "while(" and 38 instances of "while (", but keeping it in
sync with the NetBSD source tree is more important than stylistic
consistency.
@cperciva cperciva merged commit 725a54c into master Apr 26, 2022
@gperciva gperciva deleted the libcperciva-import branch April 26, 2022 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants