PVS-StudioWarnings

PVS-Studio warning V557 for IPP Samples

Nov 19th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. Ipp32f pa_nb_long[NUM_CHANNELS][2][MAX_PPT_LONG];
  2.  
  3. MP3Status mp3enc_psychoacousticInit(....)
  4. {
  5.   ...
  6.   for (ch = 0; ch < NUM_CHANNELS; ch++)
  7.     for (i = 0; i < MAX_PPT_LONG; i++) {
  8.       for (j = 0; j < 3; j++)
  9.         state->pa_nb_long[ch][j][i] = (Ipp32f)1.0e30;
  10.     }
  11.   ...
  12. }
  13.  
  14. This is what should have been written here: for (j = 0; j < 2; j++)
  15.  
  16. This suspicious code was found in IPP Samples project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V557 Array overrun is possible. The value of 'j' index could reach 2. mp3_enc mp3enc_psychoacoustic_fp.c 361
  19.  
  20. 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