mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 14:40:31 +00:00
Merge pull request #27719 from mrc0mmand/fuzz-tweaks
fuzz: a couple of fixes for issues found by Nallocfuzz
This commit is contained in:
@@ -10,7 +10,6 @@ System and Service Manager
|
||||
[](https://jenkins-systemd.apps.ocp.cloud.ci.centos.org/job/upstream-centos8/)<br/>
|
||||
[](https://jenkins-systemd.apps.ocp.cloud.ci.centos.org/job/upstream-vagrant-archlinux/)<br/>
|
||||
[&job=upstream-vagrant-archlinux-sanitizers)](https://jenkins-systemd.apps.ocp.cloud.ci.centos.org/job/upstream-vagrant-archlinux-sanitizers/)<br/>
|
||||
[&job=upstream-vagrant-rawhide-selinux)](https://jenkins-systemd.apps.ocp.cloud.ci.centos.org/view/Upstream/job/upstream-vagrant-rawhide-selinux/)<br/>
|
||||
[](https://fossies.org/linux/test/systemd-main.tar.gz/codespell.html)</br>
|
||||
[](https://translate.fedoraproject.org/engage/systemd/)</br>
|
||||
[](https://coveralls.io/github/systemd/systemd?branch=main)</br>
|
||||
|
||||
@@ -15,7 +15,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
if (!getenv("SYSTEMD_LOG_LEVEL"))
|
||||
log_set_max_level(LOG_CRIT);
|
||||
|
||||
str = memdup_suffix0(data, size);
|
||||
assert_se(str = memdup_suffix0(data, size));
|
||||
|
||||
size_t l1 = strlen(str);
|
||||
const char* usecs = l1 < size ? str + l1 + 1 : "";
|
||||
|
||||
@@ -12,7 +12,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
if (!getenv("SYSTEMD_LOG_LEVEL"))
|
||||
log_set_max_level(LOG_CRIT);
|
||||
|
||||
str = memdup_suffix0(data, size);
|
||||
assert_se(str = memdup_suffix0(data, size));
|
||||
|
||||
(void) parse_timestamp(str, &usec);
|
||||
(void) parse_sec(str, &usec);
|
||||
|
||||
@@ -1203,11 +1203,12 @@ static sd_event_source *source_new(sd_event *e, bool floating, EventSourceType t
|
||||
assert(type < _SOURCE_EVENT_SOURCE_TYPE_MAX);
|
||||
assert(size_table[type] > 0);
|
||||
|
||||
/* We use expand_to_usable() here to tell gcc that it should consider this an object of the full
|
||||
* size, even if we only allocate the initial part we need. */
|
||||
s = expand_to_usable(malloc0(size_table[type]), sizeof(sd_event_source));
|
||||
s = malloc0(size_table[type]);
|
||||
if (!s)
|
||||
return NULL;
|
||||
/* We use expand_to_usable() here to tell gcc that it should consider this an object of the full
|
||||
* size, even if we only allocate the initial part we need. */
|
||||
s = expand_to_usable(s, sizeof(sd_event_source));
|
||||
|
||||
/* Note: we cannot use compound initialization here, because sizeof(sd_event_source) is likely larger
|
||||
* than what we allocated here. */
|
||||
|
||||
Reference in New Issue
Block a user