Advertisement
PVS-StudioWarnings

PVS-Studio warning V564 for Chromium

Nov 25th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #define SEC_ASN1_CHOICE        0x100000
  2.  
  3. typedef struct sec_ASN1Template_struct {
  4.   unsigned long kind;
  5.   ...
  6. } SEC_ASN1Template;
  7.  
  8. PRBool SEC_ASN1IsTemplateSimple(
  9.   const SEC_ASN1Template *theTemplate)
  10. {
  11.   ...
  12.   if (!theTemplate->kind & SEC_ASN1_CHOICE) {
  13.   ...
  14. }
  15.  
  16. This is what should have been written here: if (!(theTemplate->kind & SEC_ASN1_CHOICE)) {
  17.  
  18. This suspicious code was found in Chromium project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. nss secasn1u.c 121
  21.  
  22. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement