Add support for LOCAL_DETECT_INTEGER_OVERFLOWS
Add build system support for LOCAL_DETECT_INTEGER_OVERFLOWS. When enabled, an attempt to perform an integer arithmetic operation which overflows will result in a call to abort(). This is intended for security sensitive code, where integer overflow operations are not expected nor desirable. Two classes of underflows/overflows are detected and blocked: 1) Signed integer underflow/overflow. 2) Unsigned integer underflow/overflows. Signed integer overflows are undefined behavior, according to the C standard. Unsigned integer overflows are defined behavior, but still undesirable in security sensitive code. Only clang is supported today. gcc has -ftrapv for handling signed integer overflow, but it's widely considered broken (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35412) and we're deliberately avoiding it's use here. Change-Id: Ib4918dc84e37e83d4205e5035544545d91671e5f Vaguely-Related-Bug: 11859726
Loading
Please register or sign in to comment