-
Notifications
You must be signed in to change notification settings - Fork 197
Make expandrange able to output a single value #6034
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: master
Are you sure you want to change the base?
Conversation
| if (step_size < 1) | ||
| { | ||
| FatalError(ctx, "EXPANDRANGE Step size cannot be less than 1 or greater than the interval"); | ||
| Log(LOG_LEVEL_ERR, "%s: Step size cannot be less than 1", fp->name); |
Check notice
Code scanning / CodeQL
Pointer argument is dereferenced without checking for NULL Note
- Allow ranges with a unique value (as the range is already inclusive) - Make invalid step value a soft fail Changelog: Allow expandrange to output a single value
db2ba4d to
de9375b
Compare
larsewi
left a comment
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.
Thanks @amousset! This makes sense to me 🚀
| if (step_size < 1) | ||
| { | ||
| FatalError(ctx, "EXPANDRANGE Step size cannot be less than 1 or greater than the interval"); | ||
| assert(fp->name != NULL); |
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 see you tried to fix the CodeQL issue. Can you change it to
assert(fp != NULL);and put it in the top of the function?
|
@cf-bottom Jenkins please :) |
|
Sure, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/13365/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-13365/ |
Rationale: This avoids some special case handling when computing ranges where the bounds are equal (or lower than the step), with a consistent interface.