I suggest you ...

Out Of Bounds Checking at Start Of Array

This is 'out-of-bounds' is detected:

unsigned char buffer[5];
unsigned char* buffer_ptr = &buffer[4];

++buffer_ptr; // ERROR! now points to 1 byte after &buffer[4]
*buffer_ptr = 0x12; // assign to memory outside of buffer[]

This 'out-of-bounds' is NOT detected:

unsigned char buffer[5];
unsigned char* buffer_ptr = &buffer[0];

--buffer_ptr; // ERROR! now points to 1 byte before &buffer[0]
*buffer_ptr = 0x12; // assign to memory outside of buffer[]

As 'buffer_ptr' has been 'bound' to 'buffer' via the assignment I would have expected PC-lint to have detected this.

4 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Jon TraversJon Travers shared this idea  ·   ·  Admin →

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base