mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-13 02:28:09 +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
|
// was not already added
|
||||||
if (!isMemcmp) {
|
if (!isMemcmp) {
|
||||||
|
|
||||||
if (addedNull == false && thestring[optLen - 1] != '\0') {
|
/*
|
||||||
|
if (addedNull == false && thestring[optLen - 1] !=
|
||||||
|
'\0') {
|
||||||
|
|
||||||
thestring.append("\0", 1); // add null byte
|
thestring.append("\0", 1); // add null byte
|
||||||
optLen++;
|
optLen++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
if (!isStdString) {
|
if (!isStdString) {
|
||||||
|
|
||||||
// ensure we do not have garbage
|
// ensure we do not have garbage
|
||||||
|
@ -603,18 +603,27 @@ bool AFLdict2filePass::runOnModule(Module &M) {
|
|||||||
// was not already added
|
// was not already added
|
||||||
if (!isMemcmp) {
|
if (!isMemcmp) {
|
||||||
|
|
||||||
if (addedNull == false && thestring[optLen - 1] != '\0') {
|
/*
|
||||||
|
if (addedNull == false && thestring[optLen - 1] != '\0')
|
||||||
|
{
|
||||||
|
|
||||||
thestring.append("\0", 1); // add null byte
|
thestring.append("\0", 1); // add null byte
|
||||||
optLen++;
|
optLen++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
if (!isStdString) {
|
if (!isStdString) {
|
||||||
|
|
||||||
// ensure we do not have garbage
|
// ensure we do not have garbage
|
||||||
size_t offset = thestring.find('\0', 0);
|
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);
|
thestring = thestring.substr(0, optLen);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -442,6 +442,7 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp,
|
|||||||
bool isSizedcmp = false;
|
bool isSizedcmp = false;
|
||||||
bool isCaseInsensitive = false;
|
bool isCaseInsensitive = false;
|
||||||
Function * Callee = callInst->getCalledFunction();
|
Function * Callee = callInst->getCalledFunction();
|
||||||
|
|
||||||
if (Callee) {
|
if (Callee) {
|
||||||
|
|
||||||
isMemcmp = Callee->getName().compare("memcmp") == 0;
|
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 LLVM_VERSION_MAJOR >= 11 /* use new pass manager */
|
||||||
/* if (modified) {
|
/* if (modified) {
|
||||||
|
|
||||||
PA.abandon<XX_Manager>();
|
PA.abandon<XX_Manager>();
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
return PA;
|
return PA;
|
||||||
|
Reference in New Issue
Block a user