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
Avoid usage of uninit members of ctx #5466
Conversation
Thank you @lucic71! Can you please adjust the commit message (amend and force-push) so that the title line starts with In the @claudioandre-br We're getting CircleCI failures here:
|
`if (ctx.archive.zip64) {` is used uninitialized if `ctx.archive.zip64 = zip64;` is not executed. Memset'ing the whole struct at the beginning of the function avoids this problem.
@solardiz done! As an afterthought, do you think it would be beneficial to have clang-tidy (or other static analysis tool) integrated in the project? I expect that this error would be easily caught by such a tool. |
Thank you! Merged.
I'm not familiar with |
@solardiz I ran clang-tidy over zip2john.c to see if there is some interesting output. I got:
Did you see these errors reported on normal compilation? Also note that the final error is the one reported in this PR. |
I don't recall seeing them. We seem to use // unused
(void) Flags;
(void) Bitlen;
(void) Reserved1;
(void) Size; which I guess suppressed them, even though the above was above the assignments. I think I've just patched these warnings, please try re-running clang-tidy. As to |
if (ctx.archive.zip64) {
is used uninitialized ifctx.archive.zip64 = zip64;
is not executed. Memset'ing the whole struct at the beginning of the function avoids this problem.