Advertisement
PVS-StudioWarnings

PVS-Studio warning V509 for TortoiseSVN

Nov 24th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. CCacheFileOutBuffer::~CCacheFileOutBuffer()
  2. {
  3.   if (IsOpen())
  4.   {
  5.     streamOffsets.push_back (GetFileSize());
  6.     size_t lastOffset = streamOffsets[0];
  7.     for (size_t i = 1,
  8.          count = streamOffsets.size();
  9.          i < count; ++i)
  10.     {
  11.       size_t offset = streamOffsets[i];
  12.       size_t size = offset - lastOffset;
  13.  
  14.       if (size >= (DWORD)(-1))
  15.         throw CStreamException("stream too large");
  16.  
  17.       Add ((DWORD)size);
  18.       lastOffset = offset;
  19.     }
  20.  
  21.     Add ((DWORD)(streamOffsets.size()-1));
  22.   }
  23. }
  24.  
  25. This suspicious code was found in TortoiseSVN project by PVS-Studio static code analyzer.
  26. Warning message is:
  27. V509 The 'throw' operator inside the destructor should be placed within the try..catch block. Raising exception inside the destructor is illegal. cachefileoutbuffer.cpp 52
  28.  
  29. 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