Advertisement
PVS-StudioWarnings

PVS-Studio warning V555 for OpenSSL

Nov 21st, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. typedef struct ok_struct
  2. {
  3.   ....
  4.   size_t buf_len_save;
  5.   size_t buf_off_save;
  6.   ....
  7. } BIO_OK_CTX;
  8.  
  9. static int ok_read(BIO *b, char *out, int outl)
  10. {
  11.   ....
  12.   BIO_OK_CTX *ctx;
  13.   ....
  14.   /* copy start of the next block into proper place */
  15.   if(ctx->buf_len_save - ctx->buf_off_save > 0)
  16.   ....
  17. }
  18.  
  19. This suspicious code was found in OpenSSL project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V555 The expression of the 'A - B > 0' kind will work as 'A != B'. bio_ok.c 243
  22.  
  23. 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