Advertisement
PVS-StudioWarnings

PVS-Studio warning V557 for IPP Samples

Nov 25th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1. struct AVS_MB_INFO
  2. {
  3.   ...
  4.   Ipp8u refIdx[AVS_DIRECTIONS][4];
  5.   ...
  6. };
  7.  
  8. void AVSCompressor::GetRefIndiciesBSlice(void){
  9.   ...
  10.   if (m_pMbInfo->predType[0] & predType)
  11.   {
  12.     m_refIdx[iRefNum] = m_pMbInfo->refIdx[dir][0];
  13.     iRefNum += 1;
  14.   }
  15.   if (m_pMbInfo->predType[1] & predType)
  16.   {
  17.     m_refIdx[iRefNum] = m_pMbInfo->refIdx[dir][1];
  18.     iRefNum += 1;
  19.   }
  20.   if (m_pMbInfo->predType[2] & predType)
  21.   {
  22.     m_refIdx[iRefNum] = m_pMbInfo->refIdx[dir][2];
  23.     iRefNum += 1;
  24.   }
  25.   if (m_pMbInfo->predType[3] & predType)
  26.   {
  27.     m_refIdx[iRefNum] = m_pMbInfo->refIdx[dir][30];
  28.     iRefNum += 1;
  29.   }
  30.   ...
  31. }
  32.  
  33. The programmer's hand faltered and now we have 30 instead of 3.
  34.  
  35. This suspicious code was found in IPP Samples project by PVS-Studio static code analyzer.
  36. Warning message is:
  37. V557 Array overrun is possible. The '30' index is pointing beyond array bound. avs_enc umc_avs_enc_compressor_enc_b.cpp 495
  38.  
  39. 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