fix llvm for unicode strings (hopefully)
MODIFY
instrumentation/SanitizerCoverageLTO.so.cc
instrumentation/SanitizerCoverageLTO.so.cc
@@ -733,7 +733,7 @@ bool ModuleSanitizerCoverage::instrumentModule(
Var->getInitializer())) {
HasStr2 = true;
- Str2 = Array->getAsString().str();
+ Str2 = Array->getRawDataValues().str();
}
@@ -809,7 +809,7 @@ bool ModuleSanitizerCoverage::instrumentModule(
Var->getInitializer())) {
HasStr1 = true;
- Str1 = Array->getAsString().str();
+ Str1 = Array->getRawDataValues().str();
}

MODIFY
instrumentation/afl-llvm-dict2file.so.cc
instrumentation/afl-llvm-dict2file.so.cc
@@ -357,6 +357,7 @@ bool AFLdict2filePass::runOnModule(Module &M) {
StringRef TmpStr;
bool HasStr1;
getConstantStringInfo(Str1P, TmpStr);
+
if (TmpStr.empty()) {
HasStr1 = false;
@@ -403,7 +404,7 @@ bool AFLdict2filePass::runOnModule(Module &M) {
dyn_cast<ConstantDataArray>(Var->getInitializer())) {
HasStr2 = true;
- Str2 = Array->getAsString().str();
+ Str2 = Array->getRawDataValues().str();
}
@@ -479,7 +480,7 @@ bool AFLdict2filePass::runOnModule(Module &M) {
dyn_cast<ConstantDataArray>(Var->getInitializer())) {
HasStr1 = true;
- Str1 = Array->getAsString().str();
+ Str1 = Array->getRawDataValues().str();
}

MODIFY
instrumentation/afl-llvm-lto-instrumentation.so.cc
instrumentation/afl-llvm-lto-instrumentation.so.cc
@@ -519,7 +519,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
Var->getInitializer())) {
HasStr2 = true;
- Str2 = Array->getAsString().str();
+ Str2 = Array->getRawDataValues().str();
}
@@ -595,7 +595,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
Var->getInitializer())) {
HasStr1 = true;
- Str1 = Array->getAsString().str();
+ Str1 = Array->getRawDataValues().str();
}

MODIFY
instrumentation/compare-transform-pass.so.cc
instrumentation/compare-transform-pass.so.cc
@@ -229,9 +229,9 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp,
dyn_cast<ConstantDataArray>(Var->getInitializer())) {
HasStr2 = true;
- Str2 = Array->getAsString();
+ Str2 = Array->getRawDataValues();
valueMap[Str2P] = new std::string(Str2.str());
- fprintf(stderr, "glo2 %s\n", Str2.str().c_str());
+ // fprintf(stderr, "glo2 %s\n", Str2.str().c_str());
}
@@ -254,7 +254,7 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp,
Var->getInitializer())) {
HasStr1 = true;
- Str1 = Array->getAsString();
+ Str1 = Array->getRawDataValues();
valueMap[Str1P] = new std::string(Str1.str());
// fprintf(stderr, "glo1 %s\n", Str1.str().c_str());

fix llvm for unicode strings (hopefully)