diff options
-rw-r--r-- | instrumentation/SanitizerCoverageLTO.so.cc | 3 | ||||
-rw-r--r-- | instrumentation/compare-transform-pass.so.cc | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc index 7710e262..37726607 100644 --- a/instrumentation/SanitizerCoverageLTO.so.cc +++ b/instrumentation/SanitizerCoverageLTO.so.cc @@ -930,7 +930,8 @@ bool ModuleSanitizerCoverage::instrumentModule( } */ - if (!isStdString) { + if (!isStdString && + thestring.find('\0', 0) != std::string::npos) { // ensure we do not have garbage size_t offset = thestring.find('\0', 0); diff --git a/instrumentation/compare-transform-pass.so.cc b/instrumentation/compare-transform-pass.so.cc index 5db9c409..2eb3d77b 100644 --- a/instrumentation/compare-transform-pass.so.cc +++ b/instrumentation/compare-transform-pass.so.cc @@ -519,7 +519,7 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp, // in the unusual case the const str has embedded null // characters, the string comparison functions should terminate // at the first null - if (!isMemcmp) { + if (!isMemcmp && TmpConstStr.find('\0') != std::string::npos) { TmpConstStr.assign(TmpConstStr, 0, TmpConstStr.find('\0') + 1); |