From: Paul Eggert Date: Mon, 22 Apr 2019 03:36:56 +0000 (-0700) Subject: Port dump_bitset_clear to -fsanitize=undefined X-Git-Tag: emacs-27.0.90~3154 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4a5ed6b05a71593cda33af4da44f30eb84b51f30;p=emacs.git Port dump_bitset_clear to -fsanitize=undefined * src/pdumper.c (dump_bitset_clear): Pacify -fsanitize=undefined by avoiding memset (NULL, x, 0), which strictly speaking has undefined behavior although it works on all production platforms I know. --- diff --git a/src/pdumper.c b/src/pdumper.c index 3facd523e4a..6ab82769ec9 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -4923,7 +4923,8 @@ static void dump_bitset_clear (struct dump_bitset *bitset) { int xword_size = sizeof (bitset->bits[0]); - memset (bitset->bits, 0, bitset->number_words * xword_size); + if (bitset->number_words) + memset (bitset->bits, 0, bitset->number_words * xword_size); } struct pdumper_loaded_dump_private