Skip to content

Conversation

@nrwahl2
Copy link
Contributor

@nrwahl2 nrwahl2 commented Nov 8, 2025

This also aims to fix the fuzzer issue noted in #3985.

The only callers were a fuzzer line (which was only there to test this
function) and a unit test of a different function. We can just do the
assignment inside the unit test.

This leaves a little bit of duplication with time_to_hr(), but the goal
is to replace most of our iso8601 library with something external (see
upstream task T432). So I'm not concerned about duplication in one
place.

This does requires exposing struct crm_time_s internally, so that we can
reference its members in the unit test. Alternatively we could create
getter functions for the members, but this is easier.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
This aims to address a false positive issue found by a fuzzer. See:

ClusterLabs#3985
https://issues.oss-fuzz.com/issues/456526118 (likely will get "Access
Denied")

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
And implement a few other best practices, like bool instead of gboolean,
limiting scope, and using const.

Replace three temporary string variables (timestamp, timestamp_epoch,
and timestamp_usec) with one (str).

Use the fact that the now variable is guaranteed non-NULL by the time we
reach the place where we set the three timestamp params, to remove some
nesting.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
A pcmk__time_hr_t object is just a crm_time_t with an int appended for
useconds. Instead of taking that object, having to construct it, etc.,
just take the crm_time_t and int.

This removes the sole use of pcmk__time_hr_t, so that we can drop it.
This makes sense to do, given that our goal is to replace most of our
time library with something external (see T432).

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
It has no remaining callers.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Nothing uses it anymore.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
It's basically redundant.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
@nrwahl2 nrwahl2 requested a review from clumens November 8, 2025 22:33
@clumens clumens merged commit fd85f9e into ClusterLabs:main Nov 17, 2025
1 check passed
@nrwahl2 nrwahl2 deleted the nrwahl2-fuzz branch November 18, 2025 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants