-
Couldn't load subscription status.
- Fork 15k
[UBSAN] add null and alignment checks for aggregates #164548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
856ac3b
a42a794
4b7ff1e
85ee368
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2249,6 +2249,21 @@ void CodeGenFunction::EmitAggregateCopy(LValue Dest, LValue Src, QualType Ty, | |
| bool isVolatile) { | ||
| assert(!Ty->isAnyComplexType() && "Shouldn't happen for complex"); | ||
|
|
||
| if (SanOpts.hasOneOf(SanitizerKind::Null | SanitizerKind::Alignment)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recommend omitting this check and leaving |
||
| Address SrcAddr = Src.getAddress(); | ||
| Address DestAddr = Dest.getAddress(); | ||
|
|
||
| // Check source pointer for null and alignment violations | ||
| EmitTypeCheck(TCK_Load, SourceLocation(), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the scope should be expanded to other cases covered by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the suggestion @hubert-reinterpretcast Line 802 ( Both cases are already covered: These checks are complementary rather than redundant: The |
||
| SrcAddr.emitRawPointer(*this), Ty, SrcAddr.getAlignment(), | ||
| SanitizerSet()); | ||
|
|
||
| // Check destination pointer for null and alignment violations | ||
| EmitTypeCheck(TCK_Store, SourceLocation(), | ||
| DestAddr.emitRawPointer(*this), Ty, DestAddr.getAlignment(), | ||
| SanitizerSet()); | ||
| } | ||
|
|
||
| Address DestPtr = Dest.getAddress(); | ||
| Address SrcPtr = Src.getAddress(); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.