-
Notifications
You must be signed in to change notification settings - Fork 349
Fix: libcrmcommon: Don't assert in time_to_hr. #3985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This just allows time_to_hr and pcmk__time_hr_now to return NULL, which can then be handled higher up in the call stack. This is just to address an automatically filed fuzzer bug report - it can't figure out how to deal with the fact that a function it's fuzzing can assert. Fixes https://issues.oss-fuzz.com/issues/456526118
A lot of our functions can assert, so I'd like to see this addressed at the fuzzer level if at all possible. This is going to lead to more problems as people fuzz more of our code. With that said, I'm not tied to asserting in That means we're relying on that string argument being parsable as a date-time, and asserting if not. I don't think I like that. HOWEVER, the sole caller of |
I misread -- there is a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unable to view the OSS Fuzz bug. Access denied. I sent you a Slack message about it.
Anyway, I don't know if OSS Fuzz is complaining about pcmk__time_hr_now() or pcmk__time_hr_new() (it fuzzes both of them), or what.
I would like to see us drop pcmk__time_hr_new() and construct the pcmk__time_hr_t object another way in the sole caller besides the fuzzer (a unit test).
When pcmk__time_hr_now() calls time_to_hr(), the dt argument is clearly guaranteed to be non-NULL. So it should be totally safe to assert that within time_to_hr(). But at that point, pcmk__time_hr_now() would be the sole remaining caller of time_to_hr(). So we could either inline time_to_hr() or simply drop the assertion. In Pacemaker, we usually don't NULL-check arguments in a static function with a single caller. We often assert when there are multiple callers because it becomes easier to lose track of things.
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 <[email protected]>
This just allows time_to_hr and pcmk__time_hr_now to return NULL, which can then be handled higher up in the call stack. This is just to address an automatically filed fuzzer bug report - it can't figure out how to deal with the fact that a function it's fuzzing can assert.
Fixes https://issues.oss-fuzz.com/issues/456526118