Optimization-unstable code
Optimization-unstable code
Posted Dec 5, 2013 13:42 UTC (Thu) by HelloWorld (guest, #56129)In reply to: Optimization-unstable code by Felix.Braun
Parent article: Optimization-unstable code
That makes no sense. Why would there be any relationship between the buffer's bounds and len's address? You do have a point though: the check quoted in the LWN article is insufficient, and in fact, the check in the paper is different:
char *buf = ...; char *buf_end = ...; unsigned int len = ...; if (buf + len >= buf_end) return; /* len too large */ if (buf + len < buf) return; /* overflow, buf+len wrapped around */ /* write to buf[0..len-1] */