Changeset View
Changeset View
Standalone View
Standalone View
compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc
Show First 20 Lines • Show All 560 Lines • ▼ Show 20 Line(s) | 557 | static void handlePointerOverflowImpl(PointerOverflowData *Data, | |||
---|---|---|---|---|---|
561 | SourceLocation Loc = Data->Loc.acquire(); | 561 | SourceLocation Loc = Data->Loc.acquire(); | ||
562 | ErrorType ET = ErrorType::PointerOverflow; | 562 | ErrorType ET = ErrorType::PointerOverflow; | ||
563 | 563 | | |||
564 | if (ignoreReport(Loc, Opts, ET)) | 564 | if (ignoreReport(Loc, Opts, ET)) | ||
565 | return; | 565 | return; | ||
566 | 566 | | |||
567 | ScopedReport R(Opts, Loc, ET); | 567 | ScopedReport R(Opts, Loc, ET); | ||
568 | 568 | | |||
569 | Diag(Loc, DL_Error, "pointer index expression with base %0 overflowed to %1") | 569 | if ((sptr(Base) >= 0) == (sptr(Result) >= 0)) | ||
570 | Diag(Loc, DL_Error, "unsigned pointer index expression result is %0, " | ||||
571 | "preceding its base %1") | ||||
572 | << (void *)Result << (void *)Base; | ||||
573 | else | ||||
574 | Diag(Loc, DL_Error, | ||||
575 | "pointer index expression with base %0 overflowed to %1") | ||||
570 | << (void *)Base << (void*)Result; | 576 | << (void *)Base << (void *)Result; | ||
571 | } | 577 | } | ||
572 | 578 | | |||
573 | void __ubsan::__ubsan_handle_pointer_overflow(PointerOverflowData *Data, | 579 | void __ubsan::__ubsan_handle_pointer_overflow(PointerOverflowData *Data, | ||
574 | ValueHandle Base, | 580 | ValueHandle Base, | ||
575 | ValueHandle Result) { | 581 | ValueHandle Result) { | ||
576 | GET_REPORT_OPTIONS(false); | 582 | GET_REPORT_OPTIONS(false); | ||
577 | handlePointerOverflowImpl(Data, Base, Result, Opts); | 583 | handlePointerOverflowImpl(Data, Base, Result, Opts); | ||
578 | } | 584 | } | ||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |