-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
i.smap: fix possible pole error with log in extract function #4499
base: main
Are you sure you want to change the base?
Conversation
I gather this issue originates from
The static analysis, takes the path where Now, in this branch of the if-else statement: Lines 144 to 160 in bc9cb2a
there are two loops over Wouldn't it better to change the Footnotes
|
b1597d6
to
4d30fc3
Compare
@nilason : I agree with your suggestion, it's a much cleaner way. Thanks! I have modified the code to reflect that and I also added an |
Using logarithm function call with zero argument will lead to a pole error, which occurs if the mathematical function has an exact infinite result. Refactor the conditional to only execute the code when number of subclasses are more than 1, which would preemptively stop us from getting into situation where log would have a zero argument. In cases where number of subclasses are <= 0, set the default value to 0. This is necessary as `ll` points to malloc'd memory and can contain renadom value. Signed-off-by: Mohan Yelugoti <[email protected]>
4d30fc3
to
cf4a759
Compare
Documented each supression issue with comments to distinguish between false positives and true positives awaiting resolution. For the false positives supressions, appropriate information is provided on why those were considered as false positive. True positives will be removed from the suppression file once their corresponding fixes(OSGeo#4702, OSGeo#4638, OSGeo#4500, OSGeo#4499) are merged. Run: `cppcheck --suppressions-list=.cppcheck-supressions <path>` Signed-off-by: Mohan Yelugoti <[email protected]>
Documented each suppression issue with comments to distinguish between false positives and true positives awaiting resolution. For the false positives suppressions, appropriate information is provided on why those were considered as false positive. True positives will be removed from the suppression file once their corresponding fixes(OSGeo#4702, OSGeo#4638, OSGeo#4500, OSGeo#4499) are merged. Run: `cppcheck --suppressions-list=.cppcheck-suppressions <path>` Signed-off-by: Mohan Yelugoti <[email protected]>
Using logarithm function call with zero argument will lead to a pole error, which occurs if the mathematical function has an exact infinite result.
Refactor the conditional to only execute the code when number of subclasses are more than 1, which would preemptively stop us from getting into situation where log would have a zero argument. In cases where number of subclasses are <= 0, set the default value to 0. This is necessary as
ll
points to malloc'd memory and can contain renadom value.References:
[1] https://en.cppreference.com/w/c/numeric/math/log
[2] SEI CERT C Coding Standard