Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

progier389
Copy link
Contributor

@progier389 progier389 commented Jul 5, 2024

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!)

@progier389 progier389 self-assigned this Jul 5, 2024
@progier389 progier389 linked an issue Jul 5, 2024 that may be closed by this pull request
@progier389 progier389 force-pushed the i6248 branch 3 times, most recently from 81f23ad to 392fefb Compare July 9, 2024 13:58
Copy link
Member

@droideck droideck left a 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);
Copy link
Member

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]

Copy link
Member

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;

Copy link
Contributor Author

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

@progier389
Copy link
Contributor Author

A bit funny: previous @droideck remark make me realize that I got different result
when using "-O2 -g -fanalyzer" (some errors)
than when using "-DDEBUG -DMCC_DEBUG -g3 -ggdb -gdwarf-5 -O0 -fanalyzer" (no errors)

@progier389 progier389 merged commit 7f92c01 into 389ds:main Jul 17, 2024
@progier389 progier389 deleted the i6248 branch May 20, 2025 13:05
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.

Fix gcc fanalyzer issues

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.