0

The static code analysis tool cppcheck reported a severe error in the code below: I don't know what is the problem.

      #define NUM_UPDATE_COUNT 3
      #define MAX_NUM_CH_1LINE 27

      wchar_t m_cCnt_Buf[NUM_UPDATE_COUNT][MAX_NUM_CH_1LINE];

      Init_PushPt();

      memset((char *)&m_cCnt_Buf[1], 0x20, sizeof(m_cCnt_Buf[1])); /* Buffer is accessed out of bounds: m_cCnt_Buf */
      memset((char *)&m_cCnt_Buf[2], 0x20, sizeof(m_cCnt_Buf[2])); /* Buffer is accessed out of bounds: m_cCnt_Buf */               
      m_cCnt_Buf[1][2] = '0';
      m_cCnt_Buf[2][8] = '0';

There doesn't seem to be anything wrong with the code above. Any ideas why these get picked up and how fix this? Thank you in advance.

canon
  • 1

1 Answers1

0

I am a Cppcheck developer.

Interesting. It looks like a FP to me. However I fail to reproduce this FP with Cppcheck.

Daniel Marjamäki
  • 2,907
  • 15
  • 16
  • 1
    You can report any Cppcheck-FP you see in the Cppcheck issue tracker (http://trac.cppcheck.net), fixing FP reports is high priority. A minimal code example that reproduce the FP should be included in the report. – Daniel Marjamäki Sep 16 '14 at 08:35