Advertisement
PVS-StudioWarnings

PVS-Studio warning V557 for Chromium

Nov 25th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. static const int kNumPainters = 3;
  2.  
  3. static const struct {
  4.   const char* name;
  5.   GPUPainter* painter;
  6. } painters[] = {
  7.   { "CPU CSC + GPU Render", new CPUColorPainter() },
  8.   { "GPU CSC/Render", new GPUColorWithLuminancePainter() },
  9. };
  10.  
  11. int main(int argc, char** argv) {
  12.   ....
  13.   // Run GPU painter tests.
  14.   for (int i = 0; i < kNumPainters; i++) {
  15.     scoped_ptr<GPUPainter> painter(painters[i].painter);
  16.   ....
  17. }
  18.  
  19. This suspicious code was found in Chromium project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V557 Array overrun is possible. The value of 'i' index could reach 2. shader_bench.cc 152
  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