Skip to content
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

Resolve clang analyzer warning for localtime.c #28

Closed
wants to merge 1 commit into from
Closed

Resolve clang analyzer warning for localtime.c #28

wants to merge 1 commit into from

Conversation

jengelh
Copy link

@jengelh jengelh commented Aug 9, 2021

If malloc() yielded NULL but also left or set errno to 0 (under
very un-POSIX-y circumstances like private malloc implementations),
then tzload would effectively signal success to its caller though
there it was no success, and code branches would execute that were
not meant to be executed.

clang said:

localtime.c:321:16: warning: The right operand of '<' is a garbage
value [core.UndefinedBinaryOperatorResult]
for (i = 0; i < sp->charcnt; ++i)

If malloc() yielded NULL but also left or set errno to 0 (under
very un-POSIX-y circumstances like private malloc implementations),
then tzload would effectively signal success to its caller though
there it was no success, and code branches would execute that were
not meant to be executed.

clang said:

localtime.c:321:16: warning: The right operand of '<' is a garbage
value [core.UndefinedBinaryOperatorResult]
        for (i = 0; i < sp->charcnt; ++i)
@eggert
Copy link
Owner

eggert commented Aug 10, 2021

I replied on the tz mailing list.

@eggert eggert closed this Aug 10, 2021
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.

2 participants