summaryrefslogtreecommitdiff
path: root/lib/imap.h
diff options
context:
space:
mode:
authorEric Lubin <eric@lubin.us>2013-12-10 20:01:07 -0800
committerDaniel Stenberg <daniel@haxx.se>2013-12-11 16:32:21 +0100
commit7246dffff5c7d046c7558ca6bf35781a2fe58ee9 (patch)
tree0e20082a52a52eba1110ee0597853207e67a4008 /lib/imap.h
parent41d21e460fc0455c01577ea5d88d89fdfe216a10 (diff)
downloadcurl-7246dffff5c7d046c7558ca6bf35781a2fe58ee9.tar.gz
parsedate: avoid integer overflow
In C, signed integer overflow is undefined behavior. Thus, the compiler is allowed to assume that it will not occur. In the check for an overflow, the developer assumes that the signed integer of type time_t will wrap around if it overflows. However, this behavior is undefined in the C standard. Thus, when the compiler sees this, it simplifies t + delta < t to delta < 0. Since delta > 0 and delta < 0 can't both be true, the entire if statement is optimized out under certain optimization levels. Thus, the parsedate function would return PARSEDATE_OK with an undefined value in the time, instead of return -1 = PARSEDATE_FAIL.
Diffstat (limited to 'lib/imap.h')
0 files changed, 0 insertions, 0 deletions