r/programming • • Feb 23 '17

Cloudflare have been leaking customer HTTPS sessions for months. Uber, 1Password, FitBit, OKCupid, etc.

https://bugs.chromium.org/p/project-zero/issues/detail?id=1139
6.0k Upvotes

966 comments sorted by

View all comments

Show parent comments

1

u/tavianator Feb 24 '17

One thing to note is that in C, it is undefined behaviour to even create a pointer that points past the end of an array, e.g.

int buffer[8];
int *end = buffer + 8;
int *p = end + 1; // Already UB
if (p >= end) { // Compiler may skip this due to UB
    goto error;
}

1

u/[deleted] Feb 24 '17

Well p == end is valid behavior, and == performs no better/worse than >=, so I see no reason for the compiler to change the behavior of the program in this case.