-
Notifications
You must be signed in to change notification settings - Fork 107
Issue 6248 - fix fanalyzer warnings #6253
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
Conversation
81f23ad
to
392fefb
Compare
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.
LGTM! And the tests passed fully, which is nice to see!
/* referral list is already an array of berval* */ | ||
if (value) | ||
slapi_entry_attr_replace(e, cgas->attr_name, (struct berval **)*value); | ||
slapi_entry_attr_replace(e, cgas->attr_name, *(struct berval ***)value); |
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.
We still have a warning here:
stack-based buffer over-read [CWE-126] [-Wanalyzer-out-of-bounds]
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.
Will something like this calm it?
/* referral list is already an array of berval* */
if (value) {
struct berval **referral_list = *(struct berval ***)value;
if (referral_list) {
slapi_entry_attr_replace(e, cgas->attr_name, referral_list);
} else {
slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
}
} else {
slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
}
break;
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.
FYI: I got 10 warnings for libglobs.c, I suspect it is again the false positive about following different branches in different switches
A bit funny: previous @droideck remark make me realize that I got different result |
This change remove all gcc -fanalyzer warnings.
Number of them are not that interesting (False/positive due to some limts of the analyzer and some possible crashes when running out of memory.
But some of these warnings where real concerns.
Issue #6248
Reviewed by: @droideck (Thanks!)