Skip to content

Commit

Permalink
False clang-scan warning from be64enc
Browse files Browse the repository at this point in the history
  • Loading branch information
gperciva committed May 4, 2022
1 parent d26245e commit 9d75418
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions crypto/crypto_aesctr.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,24 @@ crypto_aesctr_init2(struct crypto_aesctr * stream,
*/
stream->pblk[15] = 0xff;

#ifdef __clang_analyzer__
/**
* This appears to be a known bug in the clang analyzer:
* "... our memory model fails to confirm that writing a 32-bit
* integer would initialize all 4 bytes of that integer"
* https://bugs.llvm.org/show_bug.cgi?id=44114#c1
*
* The work around comes from another comment in that thread by the
* same developer:
* "The function is completely fake, of course, but nobody will
* notice that it's fake until link time, and the analyzer will
* not do linking, so it's fine."
* https://bugs.llvm.org/show_bug.cgi?id=44114#c3
*/
for (int i = 0; i < 4; i++)
fake_clang_analyzer_initialized(stream->pblk[i]);
#endif

#ifdef HWACCEL
hwaccel_init();
#endif
Expand Down

0 comments on commit 9d75418

Please sign in to comment.