]> Savannah Git Hosting - gnulib.git/commit
reallocarray: don’t crash if item size is 0
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 26 Apr 2021 01:24:42 +0000 (18:24 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 26 Apr 2021 01:25:31 +0000 (18:25 -0700)
commit974ddbe54c37dd1f8f0f0f11f6f967d6fecd864d
tree7b106c0d4f17a403adefeaee5fd8f50494731030
parentffdf094f83481d04c58fc36fc7a32ba440f365c7
reallocarray: don’t crash if item size is 0

This problem affects only platforms where xalloc_oversized
divides a number by the size arg.  Fix this by defining
xalloc_oversized (n, s) to work even if s == 0.
* lib/malloca.h, lib/xalloc-oversized.h: Document new behavior.
* lib/xalloc-oversized.h (__xalloc_oversized): Do not crash if S==0.
* tests/test-reallocarray.c (main): Test for the bug.
ChangeLog
lib/malloca.h
lib/xalloc-oversized.h
tests/test-reallocarray.c