mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-11 17:51:32 +00:00
do not add zero byte on string compares with len
This commit is contained in:
@ -922,13 +922,16 @@ bool ModuleSanitizerCoverage::instrumentModule(
|
||||
// was not already added
|
||||
if (!isMemcmp) {
|
||||
|
||||
if (addedNull == false && thestring[optLen - 1] != '\0') {
|
||||
/*
|
||||
if (addedNull == false && thestring[optLen - 1] !=
|
||||
'\0') {
|
||||
|
||||
thestring.append("\0", 1); // add null byte
|
||||
optLen++;
|
||||
thestring.append("\0", 1); // add null byte
|
||||
optLen++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
if (!isStdString) {
|
||||
|
||||
// ensure we do not have garbage
|
||||
|
@ -603,18 +603,27 @@ bool AFLdict2filePass::runOnModule(Module &M) {
|
||||
// was not already added
|
||||
if (!isMemcmp) {
|
||||
|
||||
if (addedNull == false && thestring[optLen - 1] != '\0') {
|
||||
/*
|
||||
if (addedNull == false && thestring[optLen - 1] != '\0')
|
||||
{
|
||||
|
||||
thestring.append("\0", 1); // add null byte
|
||||
optLen++;
|
||||
thestring.append("\0", 1); // add null byte
|
||||
optLen++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
if (!isStdString) {
|
||||
|
||||
// ensure we do not have garbage
|
||||
size_t offset = thestring.find('\0', 0);
|
||||
if (offset + 1 < optLen) optLen = offset + 1;
|
||||
if (offset && offset < opLen && offset + 1 < optLen) {
|
||||
|
||||
optLen = offset + 1;
|
||||
|
||||
}
|
||||
|
||||
thestring = thestring.substr(0, optLen);
|
||||
|
||||
}
|
||||
|
@ -442,6 +442,7 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp,
|
||||
bool isSizedcmp = false;
|
||||
bool isCaseInsensitive = false;
|
||||
Function * Callee = callInst->getCalledFunction();
|
||||
|
||||
if (Callee) {
|
||||
|
||||
isMemcmp = Callee->getName().compare("memcmp") == 0;
|
||||
|
@ -507,9 +507,9 @@ bool SplitSwitchesTransform::runOnModule(Module &M) {
|
||||
|
||||
#if LLVM_VERSION_MAJOR >= 11 /* use new pass manager */
|
||||
/* if (modified) {
|
||||
|
||||
|
||||
PA.abandon<XX_Manager>();
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
return PA;
|
||||
|
Reference in New Issue
Block a user