1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 17:51:22 +03:00
systemd/src/fuzz
Lennart Poettering 319a4f4bc4 alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size()
We recently started making more use of malloc_usable_size() and rely on
it (see the string_erase() story). Given that we don't really support
sytems where malloc_usable_size() cannot be trusted beyond statistics
anyway, let's go fully in and rework GREEDY_REALLOC() on top of it:
instead of passing around and maintaining the currenly allocated size
everywhere, let's just derive it automatically from
malloc_usable_size().

I am mostly after this for the simplicity this brings. It also brings
minor efficiency improvements I guess, but things become so much nicer
to look at if we can avoid these allocation size variables everywhere.

Note that the malloc_usable_size() man page says relying on it wasn't
"good programming practice", but I think it does this for reasons that
don't apply here: the greedy realloc logic specifically doesn't rely on
the returned extra size, beyond the fact that it is equal or larger than
what was requested.

(This commit was supposed to be a quick patch btw, but apparently we use
the greedy realloc stuff quite a bit across the codebase, so this ends
up touching *a*lot* of code.)
2021-05-19 16:42:37 +02:00
..
fuzz-bus-label.c license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
fuzz-calendarspec.c license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
fuzz-catalog.c license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
fuzz-compress.c alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size() 2021-05-19 16:42:37 +02:00
fuzz-env-file.c license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
fuzz-env-file.options fuzz: limit the maximum size of test inputs for a few parsers 2019-03-12 19:30:05 +01:00
fuzz-fido-id-desc.dict udev: Add id program and rule for FIDO security tokens 2019-09-07 02:23:58 +09:00
fuzz-hostname-setup.c Move hostname setup logic to new shared/hostname-setup.[ch] 2020-12-16 11:02:15 +01:00
fuzz-json.c license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
fuzz-main.c fuzz-main: allow the number of runs to be overridden 2021-03-06 09:32:18 +01:00
fuzz-time-util.c license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
fuzz-udev-database.c license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
fuzz-varlink.c license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
fuzz.h license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
meson.build fuzz-bus-message: move sources to src/libsystemd/ 2021-03-06 09:27:09 +01:00