Richard Smith | eda8bd0 | 2012-10-25 02:07:02 +0000 | [diff] [blame] | 1 | //===-- ubsan_handlers.cc -------------------------------------------------===// |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // Error logging entry points for the UBSan runtime. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 14 | #include "ubsan_platform.h" |
| 15 | #if CAN_SANITIZE_UB |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 16 | #include "ubsan_handlers.h" |
| 17 | #include "ubsan_diag.h" |
| 18 | |
| 19 | #include "sanitizer_common/sanitizer_common.h" |
| 20 | |
| 21 | using namespace __sanitizer; |
| 22 | using namespace __ubsan; |
| 23 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 24 | namespace __ubsan { |
| 25 | bool ignoreReport(SourceLocation SLoc, ReportOptions Opts, ErrorType ET) { |
| 26 | // We are not allowed to skip error report: if we are in unrecoverable |
| 27 | // handler, we have to terminate the program right now, and therefore |
| 28 | // have to print some diagnostic. |
| 29 | // |
| 30 | // Even if source location is disabled, it doesn't mean that we have |
| 31 | // already report an error to the user: some concurrently running |
| 32 | // thread could have acquired it, but not yet printed the report. |
| 33 | if (Opts.FromUnrecoverableHandler) |
| 34 | return false; |
| 35 | return SLoc.isDisabled() || IsPCSuppressed(ET, Opts.pc, SLoc.getFilename()); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 36 | } |
| 37 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 38 | const char *TypeCheckKinds[] = { |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 39 | "load of", "store to", "reference binding to", "member access within", |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 40 | "member call on", "constructor call on", "downcast of", "downcast of", |
| 41 | "upcast of", "cast to virtual base of"}; |
Richard Smith | eda8bd0 | 2012-10-25 02:07:02 +0000 | [diff] [blame] | 42 | } |
| 43 | |
Richard Smith | 5f11649 | 2012-12-18 04:23:18 +0000 | [diff] [blame] | 44 | static void handleTypeMismatchImpl(TypeMismatchData *Data, ValueHandle Pointer, |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 45 | ReportOptions Opts) { |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 46 | Location Loc = Data->Loc.acquire(); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 47 | |
| 48 | ErrorType ET; |
| 49 | if (!Pointer) |
| 50 | ET = ErrorType::NullPointerUse; |
| 51 | else if (Data->Alignment && (Pointer & (Data->Alignment - 1))) |
| 52 | ET = ErrorType::MisalignedPointerUse; |
| 53 | else |
| 54 | ET = ErrorType::InsufficientObjectSize; |
| 55 | |
| 56 | // Use the SourceLocation from Data to track deduplication, even if it's |
| 57 | // invalid. |
| 58 | if (ignoreReport(Loc.getSourceLocation(), Opts, ET)) |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 59 | return; |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 60 | |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 61 | SymbolizedStackHolder FallbackLoc; |
| 62 | if (Data->Loc.isInvalid()) { |
| 63 | FallbackLoc.reset(getCallerLocation(Opts.pc)); |
Richard Smith | 5f11649 | 2012-12-18 04:23:18 +0000 | [diff] [blame] | 64 | Loc = FallbackLoc; |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 65 | } |
Richard Smith | 5f11649 | 2012-12-18 04:23:18 +0000 | [diff] [blame] | 66 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 67 | ScopedReport R(Opts, Loc, ET); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 68 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 69 | switch (ET) { |
| 70 | case ErrorType::NullPointerUse: |
Richard Smith | 25ee97f | 2012-12-18 06:30:32 +0000 | [diff] [blame] | 71 | Diag(Loc, DL_Error, "%0 null pointer of type %1") |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 72 | << TypeCheckKinds[Data->TypeCheckKind] << Data->Type; |
| 73 | break; |
| 74 | case ErrorType::MisalignedPointerUse: |
Richard Smith | 25ee97f | 2012-12-18 06:30:32 +0000 | [diff] [blame] | 75 | Diag(Loc, DL_Error, "%0 misaligned address %1 for type %3, " |
| 76 | "which requires %2 byte alignment") |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 77 | << TypeCheckKinds[Data->TypeCheckKind] << (void *)Pointer |
| 78 | << Data->Alignment << Data->Type; |
| 79 | break; |
| 80 | case ErrorType::InsufficientObjectSize: |
Richard Smith | 25ee97f | 2012-12-18 06:30:32 +0000 | [diff] [blame] | 81 | Diag(Loc, DL_Error, "%0 address %1 with insufficient space " |
| 82 | "for an object of type %2") |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 83 | << TypeCheckKinds[Data->TypeCheckKind] << (void *)Pointer << Data->Type; |
| 84 | break; |
| 85 | default: |
| 86 | UNREACHABLE("unexpected error type!"); |
| 87 | } |
| 88 | |
Richard Smith | 25ee97f | 2012-12-18 06:30:32 +0000 | [diff] [blame] | 89 | if (Pointer) |
| 90 | Diag(Pointer, DL_Note, "pointer points here"); |
Will Dietz | a82a5d3 | 2012-12-02 19:47:29 +0000 | [diff] [blame] | 91 | } |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 92 | |
Richard Smith | 5f11649 | 2012-12-18 04:23:18 +0000 | [diff] [blame] | 93 | void __ubsan::__ubsan_handle_type_mismatch(TypeMismatchData *Data, |
| 94 | ValueHandle Pointer) { |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 95 | GET_REPORT_OPTIONS(false); |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 96 | handleTypeMismatchImpl(Data, Pointer, Opts); |
Richard Smith | 5f11649 | 2012-12-18 04:23:18 +0000 | [diff] [blame] | 97 | } |
Will Dietz | a82a5d3 | 2012-12-02 19:47:29 +0000 | [diff] [blame] | 98 | void __ubsan::__ubsan_handle_type_mismatch_abort(TypeMismatchData *Data, |
Richard Smith | 5f11649 | 2012-12-18 04:23:18 +0000 | [diff] [blame] | 99 | ValueHandle Pointer) { |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 100 | GET_REPORT_OPTIONS(true); |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 101 | handleTypeMismatchImpl(Data, Pointer, Opts); |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 102 | Die(); |
| 103 | } |
| 104 | |
Will Dietz | 80af605 | 2012-11-27 15:01:43 +0000 | [diff] [blame] | 105 | /// \brief Common diagnostic emission for various forms of integer overflow. |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 106 | template <typename T> |
| 107 | static void handleIntegerOverflowImpl(OverflowData *Data, ValueHandle LHS, |
| 108 | const char *Operator, T RHS, |
| 109 | ReportOptions Opts) { |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 110 | SourceLocation Loc = Data->Loc.acquire(); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 111 | bool IsSigned = Data->Type.isSignedIntegerTy(); |
| 112 | ErrorType ET = IsSigned ? ErrorType::SignedIntegerOverflow |
| 113 | : ErrorType::UnsignedIntegerOverflow; |
| 114 | |
| 115 | if (ignoreReport(Loc, Opts, ET)) |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 116 | return; |
| 117 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 118 | ScopedReport R(Opts, Loc, ET); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 119 | |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 120 | Diag(Loc, DL_Error, "%0 integer overflow: " |
| 121 | "%1 %2 %3 cannot be represented in type %4") |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 122 | << (IsSigned ? "signed" : "unsigned") |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 123 | << Value(Data->Type, LHS) << Operator << RHS << Data->Type; |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 124 | } |
| 125 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 126 | #define UBSAN_OVERFLOW_HANDLER(handler_name, op, unrecoverable) \ |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 127 | void __ubsan::handler_name(OverflowData *Data, ValueHandle LHS, \ |
| 128 | ValueHandle RHS) { \ |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 129 | GET_REPORT_OPTIONS(unrecoverable); \ |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 130 | handleIntegerOverflowImpl(Data, LHS, op, Value(Data->Type, RHS), Opts); \ |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 131 | if (unrecoverable) \ |
| 132 | Die(); \ |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 133 | } |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 134 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 135 | UBSAN_OVERFLOW_HANDLER(__ubsan_handle_add_overflow, "+", false) |
| 136 | UBSAN_OVERFLOW_HANDLER(__ubsan_handle_add_overflow_abort, "+", true) |
| 137 | UBSAN_OVERFLOW_HANDLER(__ubsan_handle_sub_overflow, "-", false) |
| 138 | UBSAN_OVERFLOW_HANDLER(__ubsan_handle_sub_overflow_abort, "-", true) |
| 139 | UBSAN_OVERFLOW_HANDLER(__ubsan_handle_mul_overflow, "*", false) |
| 140 | UBSAN_OVERFLOW_HANDLER(__ubsan_handle_mul_overflow_abort, "*", true) |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 141 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 142 | static void handleNegateOverflowImpl(OverflowData *Data, ValueHandle OldVal, |
| 143 | ReportOptions Opts) { |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 144 | SourceLocation Loc = Data->Loc.acquire(); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 145 | bool IsSigned = Data->Type.isSignedIntegerTy(); |
| 146 | ErrorType ET = IsSigned ? ErrorType::SignedIntegerOverflow |
| 147 | : ErrorType::UnsignedIntegerOverflow; |
| 148 | |
| 149 | if (ignoreReport(Loc, Opts, ET)) |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 150 | return; |
| 151 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 152 | ScopedReport R(Opts, Loc, ET); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 153 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 154 | if (IsSigned) |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 155 | Diag(Loc, DL_Error, |
Will Dietz | f359dea | 2012-12-31 06:36:44 +0000 | [diff] [blame] | 156 | "negation of %0 cannot be represented in type %1; " |
| 157 | "cast to an unsigned type to negate this value to itself") |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 158 | << Value(Data->Type, OldVal) << Data->Type; |
Will Dietz | f359dea | 2012-12-31 06:36:44 +0000 | [diff] [blame] | 159 | else |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 160 | Diag(Loc, DL_Error, "negation of %0 cannot be represented in type %1") |
| 161 | << Value(Data->Type, OldVal) << Data->Type; |
Will Dietz | a82a5d3 | 2012-12-02 19:47:29 +0000 | [diff] [blame] | 162 | } |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 163 | |
| 164 | void __ubsan::__ubsan_handle_negate_overflow(OverflowData *Data, |
| 165 | ValueHandle OldVal) { |
| 166 | GET_REPORT_OPTIONS(false); |
| 167 | handleNegateOverflowImpl(Data, OldVal, Opts); |
| 168 | } |
Will Dietz | a82a5d3 | 2012-12-02 19:47:29 +0000 | [diff] [blame] | 169 | void __ubsan::__ubsan_handle_negate_overflow_abort(OverflowData *Data, |
| 170 | ValueHandle OldVal) { |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 171 | GET_REPORT_OPTIONS(true); |
| 172 | handleNegateOverflowImpl(Data, OldVal, Opts); |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 173 | Die(); |
| 174 | } |
| 175 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 176 | static void handleDivremOverflowImpl(OverflowData *Data, ValueHandle LHS, |
| 177 | ValueHandle RHS, ReportOptions Opts) { |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 178 | SourceLocation Loc = Data->Loc.acquire(); |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 179 | Value LHSVal(Data->Type, LHS); |
| 180 | Value RHSVal(Data->Type, RHS); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 181 | |
| 182 | ErrorType ET; |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 183 | if (RHSVal.isMinusOne()) |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 184 | ET = ErrorType::SignedIntegerOverflow; |
| 185 | else if (Data->Type.isIntegerTy()) |
| 186 | ET = ErrorType::IntegerDivideByZero; |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 187 | else |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 188 | ET = ErrorType::FloatDivideByZero; |
| 189 | |
| 190 | if (ignoreReport(Loc, Opts, ET)) |
| 191 | return; |
| 192 | |
| 193 | ScopedReport R(Opts, Loc, ET); |
| 194 | |
| 195 | switch (ET) { |
| 196 | case ErrorType::SignedIntegerOverflow: |
| 197 | Diag(Loc, DL_Error, "division of %0 by -1 cannot be represented in type %1") |
| 198 | << LHSVal << Data->Type; |
| 199 | break; |
| 200 | default: |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 201 | Diag(Loc, DL_Error, "division by zero"); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 202 | break; |
| 203 | } |
Will Dietz | a82a5d3 | 2012-12-02 19:47:29 +0000 | [diff] [blame] | 204 | } |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 205 | |
| 206 | void __ubsan::__ubsan_handle_divrem_overflow(OverflowData *Data, |
| 207 | ValueHandle LHS, ValueHandle RHS) { |
| 208 | GET_REPORT_OPTIONS(false); |
| 209 | handleDivremOverflowImpl(Data, LHS, RHS, Opts); |
| 210 | } |
Will Dietz | a82a5d3 | 2012-12-02 19:47:29 +0000 | [diff] [blame] | 211 | void __ubsan::__ubsan_handle_divrem_overflow_abort(OverflowData *Data, |
| 212 | ValueHandle LHS, |
| 213 | ValueHandle RHS) { |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 214 | GET_REPORT_OPTIONS(true); |
| 215 | handleDivremOverflowImpl(Data, LHS, RHS, Opts); |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 216 | Die(); |
| 217 | } |
| 218 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 219 | static void handleShiftOutOfBoundsImpl(ShiftOutOfBoundsData *Data, |
| 220 | ValueHandle LHS, ValueHandle RHS, |
| 221 | ReportOptions Opts) { |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 222 | SourceLocation Loc = Data->Loc.acquire(); |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 223 | Value LHSVal(Data->LHSType, LHS); |
| 224 | Value RHSVal(Data->RHSType, RHS); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 225 | |
| 226 | ErrorType ET; |
| 227 | if (RHSVal.isNegative() || |
| 228 | RHSVal.getPositiveIntValue() >= Data->LHSType.getIntegerBitWidth()) |
| 229 | ET = ErrorType::InvalidShiftExponent; |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 230 | else |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 231 | ET = ErrorType::InvalidShiftBase; |
| 232 | |
| 233 | if (ignoreReport(Loc, Opts, ET)) |
| 234 | return; |
| 235 | |
| 236 | ScopedReport R(Opts, Loc, ET); |
| 237 | |
| 238 | if (ET == ErrorType::InvalidShiftExponent) { |
| 239 | if (RHSVal.isNegative()) |
| 240 | Diag(Loc, DL_Error, "shift exponent %0 is negative") << RHSVal; |
| 241 | else |
| 242 | Diag(Loc, DL_Error, "shift exponent %0 is too large for %1-bit type %2") |
| 243 | << RHSVal << Data->LHSType.getIntegerBitWidth() << Data->LHSType; |
| 244 | } else { |
| 245 | if (LHSVal.isNegative()) |
| 246 | Diag(Loc, DL_Error, "left shift of negative value %0") << LHSVal; |
| 247 | else |
| 248 | Diag(Loc, DL_Error, |
| 249 | "left shift of %0 by %1 places cannot be represented in type %2") |
| 250 | << LHSVal << RHSVal << Data->LHSType; |
| 251 | } |
Will Dietz | a82a5d3 | 2012-12-02 19:47:29 +0000 | [diff] [blame] | 252 | } |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 253 | |
| 254 | void __ubsan::__ubsan_handle_shift_out_of_bounds(ShiftOutOfBoundsData *Data, |
| 255 | ValueHandle LHS, |
| 256 | ValueHandle RHS) { |
| 257 | GET_REPORT_OPTIONS(false); |
| 258 | handleShiftOutOfBoundsImpl(Data, LHS, RHS, Opts); |
| 259 | } |
Will Dietz | a82a5d3 | 2012-12-02 19:47:29 +0000 | [diff] [blame] | 260 | void __ubsan::__ubsan_handle_shift_out_of_bounds_abort( |
| 261 | ShiftOutOfBoundsData *Data, |
| 262 | ValueHandle LHS, |
| 263 | ValueHandle RHS) { |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 264 | GET_REPORT_OPTIONS(true); |
| 265 | handleShiftOutOfBoundsImpl(Data, LHS, RHS, Opts); |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 266 | Die(); |
| 267 | } |
| 268 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 269 | static void handleOutOfBoundsImpl(OutOfBoundsData *Data, ValueHandle Index, |
| 270 | ReportOptions Opts) { |
Richard Smith | a0b1e21 | 2013-02-23 02:40:07 +0000 | [diff] [blame] | 271 | SourceLocation Loc = Data->Loc.acquire(); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 272 | ErrorType ET = ErrorType::OutOfBoundsIndex; |
| 273 | |
| 274 | if (ignoreReport(Loc, Opts, ET)) |
Richard Smith | a0b1e21 | 2013-02-23 02:40:07 +0000 | [diff] [blame] | 275 | return; |
| 276 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 277 | ScopedReport R(Opts, Loc, ET); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 278 | |
Richard Smith | a0b1e21 | 2013-02-23 02:40:07 +0000 | [diff] [blame] | 279 | Value IndexVal(Data->IndexType, Index); |
| 280 | Diag(Loc, DL_Error, "index %0 out of bounds for type %1") |
| 281 | << IndexVal << Data->ArrayType; |
| 282 | } |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 283 | |
| 284 | void __ubsan::__ubsan_handle_out_of_bounds(OutOfBoundsData *Data, |
| 285 | ValueHandle Index) { |
| 286 | GET_REPORT_OPTIONS(false); |
| 287 | handleOutOfBoundsImpl(Data, Index, Opts); |
| 288 | } |
Richard Smith | a0b1e21 | 2013-02-23 02:40:07 +0000 | [diff] [blame] | 289 | void __ubsan::__ubsan_handle_out_of_bounds_abort(OutOfBoundsData *Data, |
| 290 | ValueHandle Index) { |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 291 | GET_REPORT_OPTIONS(true); |
| 292 | handleOutOfBoundsImpl(Data, Index, Opts); |
Richard Smith | a0b1e21 | 2013-02-23 02:40:07 +0000 | [diff] [blame] | 293 | Die(); |
| 294 | } |
| 295 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 296 | static void handleBuiltinUnreachableImpl(UnreachableData *Data, |
| 297 | ReportOptions Opts) { |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 298 | ScopedReport R(Opts, Data->Loc, ErrorType::UnreachableCall); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 299 | Diag(Data->Loc, DL_Error, "execution reached a __builtin_unreachable() call"); |
| 300 | } |
| 301 | |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 302 | void __ubsan::__ubsan_handle_builtin_unreachable(UnreachableData *Data) { |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 303 | GET_REPORT_OPTIONS(true); |
| 304 | handleBuiltinUnreachableImpl(Data, Opts); |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 305 | Die(); |
| 306 | } |
| 307 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 308 | static void handleMissingReturnImpl(UnreachableData *Data, ReportOptions Opts) { |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 309 | ScopedReport R(Opts, Data->Loc, ErrorType::MissingReturn); |
Richard Smith | 25ee97f | 2012-12-18 06:30:32 +0000 | [diff] [blame] | 310 | Diag(Data->Loc, DL_Error, |
| 311 | "execution reached the end of a value-returning function " |
| 312 | "without returning a value"); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 313 | } |
| 314 | |
| 315 | void __ubsan::__ubsan_handle_missing_return(UnreachableData *Data) { |
| 316 | GET_REPORT_OPTIONS(true); |
| 317 | handleMissingReturnImpl(Data, Opts); |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 318 | Die(); |
| 319 | } |
Richard Smith | b04caf1 | 2012-10-10 01:10:59 +0000 | [diff] [blame] | 320 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 321 | static void handleVLABoundNotPositive(VLABoundData *Data, ValueHandle Bound, |
| 322 | ReportOptions Opts) { |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 323 | SourceLocation Loc = Data->Loc.acquire(); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 324 | ErrorType ET = ErrorType::NonPositiveVLAIndex; |
| 325 | |
| 326 | if (ignoreReport(Loc, Opts, ET)) |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 327 | return; |
| 328 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 329 | ScopedReport R(Opts, Loc, ET); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 330 | |
Will Dietz | 2af552f | 2013-01-09 03:40:03 +0000 | [diff] [blame] | 331 | Diag(Loc, DL_Error, "variable length array bound evaluates to " |
| 332 | "non-positive value %0") |
Richard Smith | b04caf1 | 2012-10-10 01:10:59 +0000 | [diff] [blame] | 333 | << Value(Data->Type, Bound); |
Will Dietz | a82a5d3 | 2012-12-02 19:47:29 +0000 | [diff] [blame] | 334 | } |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 335 | |
| 336 | void __ubsan::__ubsan_handle_vla_bound_not_positive(VLABoundData *Data, |
| 337 | ValueHandle Bound) { |
| 338 | GET_REPORT_OPTIONS(false); |
| 339 | handleVLABoundNotPositive(Data, Bound, Opts); |
| 340 | } |
Will Dietz | a82a5d3 | 2012-12-02 19:47:29 +0000 | [diff] [blame] | 341 | void __ubsan::__ubsan_handle_vla_bound_not_positive_abort(VLABoundData *Data, |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 342 | ValueHandle Bound) { |
| 343 | GET_REPORT_OPTIONS(true); |
| 344 | handleVLABoundNotPositive(Data, Bound, Opts); |
Richard Smith | b04caf1 | 2012-10-10 01:10:59 +0000 | [diff] [blame] | 345 | Die(); |
| 346 | } |
Richard Smith | 5856170 | 2012-10-12 22:57:15 +0000 | [diff] [blame] | 347 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 348 | static bool looksLikeFloatCastOverflowDataV1(void *Data) { |
| 349 | // First field is either a pointer to filename or a pointer to a |
| 350 | // TypeDescriptor. |
| 351 | u8 *FilenameOrTypeDescriptor; |
| 352 | internal_memcpy(&FilenameOrTypeDescriptor, Data, |
| 353 | sizeof(FilenameOrTypeDescriptor)); |
| 354 | |
| 355 | // Heuristic: For float_cast_overflow, the TypeKind will be either TK_Integer |
| 356 | // (0x0), TK_Float (0x1) or TK_Unknown (0xff). If both types are known, |
| 357 | // adding both bytes will be 0 or 1 (for BE or LE). If it were a filename, |
| 358 | // adding two printable characters will not yield such a value. Otherwise, |
| 359 | // if one of them is 0xff, this is most likely TK_Unknown type descriptor. |
| 360 | u16 MaybeFromTypeKind = |
| 361 | FilenameOrTypeDescriptor[0] + FilenameOrTypeDescriptor[1]; |
| 362 | return MaybeFromTypeKind < 2 || FilenameOrTypeDescriptor[0] == 0xff || |
| 363 | FilenameOrTypeDescriptor[1] == 0xff; |
| 364 | } |
| 365 | |
| 366 | static void handleFloatCastOverflow(void *DataPtr, ValueHandle From, |
| 367 | ReportOptions Opts) { |
| 368 | SymbolizedStackHolder CallerLoc; |
| 369 | Location Loc; |
| 370 | const TypeDescriptor *FromType, *ToType; |
| 371 | ErrorType ET = ErrorType::FloatCastOverflow; |
| 372 | |
| 373 | if (looksLikeFloatCastOverflowDataV1(DataPtr)) { |
| 374 | auto Data = reinterpret_cast<FloatCastOverflowData *>(DataPtr); |
| 375 | CallerLoc.reset(getCallerLocation(Opts.pc)); |
| 376 | Loc = CallerLoc; |
| 377 | FromType = &Data->FromType; |
| 378 | ToType = &Data->ToType; |
| 379 | } else { |
| 380 | auto Data = reinterpret_cast<FloatCastOverflowDataV2 *>(DataPtr); |
| 381 | SourceLocation SLoc = Data->Loc.acquire(); |
| 382 | if (ignoreReport(SLoc, Opts, ET)) |
| 383 | return; |
| 384 | Loc = SLoc; |
| 385 | FromType = &Data->FromType; |
| 386 | ToType = &Data->ToType; |
| 387 | } |
| 388 | |
| 389 | ScopedReport R(Opts, Loc, ET); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 390 | |
| 391 | Diag(Loc, DL_Error, |
| 392 | "value %0 is outside the range of representable values of type %2") |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 393 | << Value(*FromType, From) << *FromType << *ToType; |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 394 | } |
Richard Smith | 5f11649 | 2012-12-18 04:23:18 +0000 | [diff] [blame] | 395 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 396 | void __ubsan::__ubsan_handle_float_cast_overflow(void *Data, ValueHandle From) { |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 397 | GET_REPORT_OPTIONS(false); |
| 398 | handleFloatCastOverflow(Data, From, Opts); |
Will Dietz | a82a5d3 | 2012-12-02 19:47:29 +0000 | [diff] [blame] | 399 | } |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 400 | void __ubsan::__ubsan_handle_float_cast_overflow_abort(void *Data, |
| 401 | ValueHandle From) { |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 402 | GET_REPORT_OPTIONS(true); |
| 403 | handleFloatCastOverflow(Data, From, Opts); |
Richard Smith | 5856170 | 2012-10-12 22:57:15 +0000 | [diff] [blame] | 404 | Die(); |
| 405 | } |
Richard Smith | f2d77d0 | 2012-12-13 07:00:14 +0000 | [diff] [blame] | 406 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 407 | static void handleLoadInvalidValue(InvalidValueData *Data, ValueHandle Val, |
| 408 | ReportOptions Opts) { |
Nick Lewycky | d1bf52e | 2013-10-02 02:29:47 +0000 | [diff] [blame] | 409 | SourceLocation Loc = Data->Loc.acquire(); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 410 | // This check could be more precise if we used different handlers for |
| 411 | // -fsanitize=bool and -fsanitize=enum. |
| 412 | bool IsBool = (0 == internal_strcmp(Data->Type.getTypeName(), "'bool'")); |
| 413 | ErrorType ET = |
| 414 | IsBool ? ErrorType::InvalidBoolLoad : ErrorType::InvalidEnumLoad; |
| 415 | |
| 416 | if (ignoreReport(Loc, Opts, ET)) |
Nick Lewycky | d1bf52e | 2013-10-02 02:29:47 +0000 | [diff] [blame] | 417 | return; |
| 418 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 419 | ScopedReport R(Opts, Loc, ET); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 420 | |
Nick Lewycky | d1bf52e | 2013-10-02 02:29:47 +0000 | [diff] [blame] | 421 | Diag(Loc, DL_Error, |
Richard Smith | 25ee97f | 2012-12-18 06:30:32 +0000 | [diff] [blame] | 422 | "load of value %0, which is not a valid value for type %1") |
Richard Smith | f2d77d0 | 2012-12-13 07:00:14 +0000 | [diff] [blame] | 423 | << Value(Data->Type, Val) << Data->Type; |
| 424 | } |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 425 | |
| 426 | void __ubsan::__ubsan_handle_load_invalid_value(InvalidValueData *Data, |
| 427 | ValueHandle Val) { |
| 428 | GET_REPORT_OPTIONS(false); |
| 429 | handleLoadInvalidValue(Data, Val, Opts); |
| 430 | } |
Richard Smith | f2d77d0 | 2012-12-13 07:00:14 +0000 | [diff] [blame] | 431 | void __ubsan::__ubsan_handle_load_invalid_value_abort(InvalidValueData *Data, |
| 432 | ValueHandle Val) { |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 433 | GET_REPORT_OPTIONS(true); |
| 434 | handleLoadInvalidValue(Data, Val, Opts); |
Richard Smith | f2d77d0 | 2012-12-13 07:00:14 +0000 | [diff] [blame] | 435 | Die(); |
| 436 | } |
Peter Collingbourne | 9b5f95f | 2013-10-20 21:29:46 +0000 | [diff] [blame] | 437 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 438 | static void handleFunctionTypeMismatch(FunctionTypeMismatchData *Data, |
| 439 | ValueHandle Function, |
| 440 | ReportOptions Opts) { |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 441 | SourceLocation CallLoc = Data->Loc.acquire(); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 442 | ErrorType ET = ErrorType::FunctionTypeMismatch; |
| 443 | |
| 444 | if (ignoreReport(CallLoc, Opts, ET)) |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 445 | return; |
Peter Collingbourne | 9b5f95f | 2013-10-20 21:29:46 +0000 | [diff] [blame] | 446 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 447 | ScopedReport R(Opts, CallLoc, ET); |
Peter Collingbourne | 9b5f95f | 2013-10-20 21:29:46 +0000 | [diff] [blame] | 448 | |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 449 | SymbolizedStackHolder FLoc(getSymbolizedLocation(Function)); |
| 450 | const char *FName = FLoc.get()->info.function; |
| 451 | if (!FName) |
| 452 | FName = "(unknown)"; |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 453 | |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 454 | Diag(CallLoc, DL_Error, |
Peter Collingbourne | 9b5f95f | 2013-10-20 21:29:46 +0000 | [diff] [blame] | 455 | "call to function %0 through pointer to incorrect function type %1") |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 456 | << FName << Data->Type; |
| 457 | Diag(FLoc, DL_Note, "%0 defined here") << FName; |
Peter Collingbourne | 9b5f95f | 2013-10-20 21:29:46 +0000 | [diff] [blame] | 458 | } |
| 459 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 460 | void |
| 461 | __ubsan::__ubsan_handle_function_type_mismatch(FunctionTypeMismatchData *Data, |
| 462 | ValueHandle Function) { |
| 463 | GET_REPORT_OPTIONS(false); |
| 464 | handleFunctionTypeMismatch(Data, Function, Opts); |
| 465 | } |
| 466 | |
Peter Collingbourne | 9b5f95f | 2013-10-20 21:29:46 +0000 | [diff] [blame] | 467 | void __ubsan::__ubsan_handle_function_type_mismatch_abort( |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 468 | FunctionTypeMismatchData *Data, ValueHandle Function) { |
| 469 | GET_REPORT_OPTIONS(true); |
| 470 | handleFunctionTypeMismatch(Data, Function, Opts); |
| 471 | Die(); |
| 472 | } |
| 473 | |
| 474 | static void handleNonNullReturn(NonNullReturnData *Data, ReportOptions Opts) { |
| 475 | SourceLocation Loc = Data->Loc.acquire(); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 476 | ErrorType ET = ErrorType::InvalidNullReturn; |
| 477 | |
| 478 | if (ignoreReport(Loc, Opts, ET)) |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 479 | return; |
| 480 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 481 | ScopedReport R(Opts, Loc, ET); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 482 | |
| 483 | Diag(Loc, DL_Error, "null pointer returned from function declared to never " |
| 484 | "return null"); |
| 485 | if (!Data->AttrLoc.isInvalid()) |
| 486 | Diag(Data->AttrLoc, DL_Note, "returns_nonnull attribute specified here"); |
| 487 | } |
| 488 | |
| 489 | void __ubsan::__ubsan_handle_nonnull_return(NonNullReturnData *Data) { |
| 490 | GET_REPORT_OPTIONS(false); |
| 491 | handleNonNullReturn(Data, Opts); |
| 492 | } |
| 493 | |
| 494 | void __ubsan::__ubsan_handle_nonnull_return_abort(NonNullReturnData *Data) { |
| 495 | GET_REPORT_OPTIONS(true); |
| 496 | handleNonNullReturn(Data, Opts); |
| 497 | Die(); |
| 498 | } |
| 499 | |
| 500 | static void handleNonNullArg(NonNullArgData *Data, ReportOptions Opts) { |
| 501 | SourceLocation Loc = Data->Loc.acquire(); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 502 | ErrorType ET = ErrorType::InvalidNullArgument; |
| 503 | |
| 504 | if (ignoreReport(Loc, Opts, ET)) |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 505 | return; |
| 506 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 507 | ScopedReport R(Opts, Loc, ET); |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 508 | |
| 509 | Diag(Loc, DL_Error, "null pointer passed as argument %0, which is declared to " |
| 510 | "never be null") << Data->ArgIndex; |
| 511 | if (!Data->AttrLoc.isInvalid()) |
| 512 | Diag(Data->AttrLoc, DL_Note, "nonnull attribute specified here"); |
| 513 | } |
| 514 | |
| 515 | void __ubsan::__ubsan_handle_nonnull_arg(NonNullArgData *Data) { |
| 516 | GET_REPORT_OPTIONS(false); |
| 517 | handleNonNullArg(Data, Opts); |
| 518 | } |
| 519 | |
| 520 | void __ubsan::__ubsan_handle_nonnull_arg_abort(NonNullArgData *Data) { |
| 521 | GET_REPORT_OPTIONS(true); |
| 522 | handleNonNullArg(Data, Opts); |
Peter Collingbourne | 9b5f95f | 2013-10-20 21:29:46 +0000 | [diff] [blame] | 523 | Die(); |
| 524 | } |
Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 525 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 526 | static void handleCFIBadIcall(CFIBadIcallData *Data, ValueHandle Function, |
| 527 | ReportOptions Opts) { |
| 528 | SourceLocation Loc = Data->Loc.acquire(); |
| 529 | ErrorType ET = ErrorType::CFIBadType; |
| 530 | |
| 531 | if (ignoreReport(Loc, Opts, ET)) |
| 532 | return; |
| 533 | |
| 534 | ScopedReport R(Opts, Loc, ET); |
| 535 | |
| 536 | Diag(Loc, DL_Error, "control flow integrity check for type %0 failed during " |
| 537 | "indirect function call") |
| 538 | << Data->Type; |
| 539 | |
| 540 | SymbolizedStackHolder FLoc(getSymbolizedLocation(Function)); |
| 541 | const char *FName = FLoc.get()->info.function; |
| 542 | if (!FName) |
| 543 | FName = "(unknown)"; |
| 544 | Diag(FLoc, DL_Note, "%0 defined here") << FName; |
| 545 | } |
| 546 | |
| 547 | void __ubsan::__ubsan_handle_cfi_bad_icall(CFIBadIcallData *Data, |
| 548 | ValueHandle Function) { |
| 549 | GET_REPORT_OPTIONS(false); |
| 550 | handleCFIBadIcall(Data, Function, Opts); |
| 551 | } |
| 552 | |
| 553 | void __ubsan::__ubsan_handle_cfi_bad_icall_abort(CFIBadIcallData *Data, |
| 554 | ValueHandle Function) { |
| 555 | GET_REPORT_OPTIONS(true); |
| 556 | handleCFIBadIcall(Data, Function, Opts); |
| 557 | Die(); |
| 558 | } |
| 559 | |
Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 560 | #endif // CAN_SANITIZE_UB |