Merge "Enable object-size sanitizer for C++" into main

This commit is contained in:
Treehugger Robot
2024-09-18 19:44:30 +00:00
committed by Gerrit Code Review
2 changed files with 9 additions and 4 deletions

View File

@@ -238,6 +238,11 @@ func (c Config) ReleaseAconfigFlagDefaultPermission() string {
return c.config.productVariables.ReleaseAconfigFlagDefaultPermission
}
// Enable object size sanitizer
func (c Config) ReleaseBuildObjectSizeSanitizer() bool {
return c.config.productVariables.GetBuildFlagBool("RELEASE_BUILD_OBJECT_SIZE_SANITIZER")
}
// The flag indicating behavior for the tree wrt building modules or using prebuilts
// derived from RELEASE_DEFAULT_MODULE_BUILD_FROM_SOURCE
func (c Config) ReleaseDefaultModuleBuildFromSource() bool {

View File

@@ -1437,11 +1437,11 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
//"null",
//"shift-base",
//"signed-integer-overflow",
// TODO(danalbert): Fix UB in libc++'s __tree so we can turn this on.
// https://llvm.org/PR19302
// http://reviews.llvm.org/D6974
// "object-size",
)
if mctx.Config().ReleaseBuildObjectSizeSanitizer() {
sanitizers = append(sanitizers, "object-size")
}
}
sanitizers = append(sanitizers, sanProps.Misc_undefined...)
}