about summary refs log tree commit diff
path: root/instrumentation
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-05-21 10:26:27 +0200
committervanhauser-thc <vh@thc.org>2021-05-21 10:26:35 +0200
commit5997a4fc09163c1baa186f5a9d00c4c8668a72b1 (patch)
tree8a3b10724943a7e608e0b5291639660b4d830898 /instrumentation
parenta1458ea6715e8801bf28fec0ac66f06b96eb1e66 (diff)
downloadafl++-5997a4fc09163c1baa186f5a9d00c4c8668a72b1.tar.gz
fix llvm-dict2file
Diffstat (limited to 'instrumentation')
-rw-r--r--instrumentation/afl-llvm-dict2file.so.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/instrumentation/afl-llvm-dict2file.so.cc b/instrumentation/afl-llvm-dict2file.so.cc
index c954054b..e2b44b21 100644
--- a/instrumentation/afl-llvm-dict2file.so.cc
+++ b/instrumentation/afl-llvm-dict2file.so.cc
@@ -426,7 +426,7 @@ bool AFLdict2filePass::runOnModule(Module &M) {
               ConstantInt *ilen = dyn_cast<ConstantInt>(op2);
               if (ilen) {
 
-                uint64_t literalLength = Str2.size();
+                uint64_t literalLength = Str2.length();
                 uint64_t optLength = ilen->getZExtValue();
                 if (literalLength + 1 == optLength) {
 
@@ -434,6 +434,8 @@ bool AFLdict2filePass::runOnModule(Module &M) {
 
                 }
 
+                if (optLength > Str2.length()) { optLength = Str2.length(); }
+
               }
 
               valueMap[Str1P] = new std::string(Str2);
@@ -532,6 +534,7 @@ bool AFLdict2filePass::runOnModule(Module &M) {
 
               uint64_t literalLength = optLen;
               optLen = ilen->getZExtValue();
+              if (optLen > thestring.length()) { optLen = thestring.length(); }
               if (optLen < 2) { continue; }
               if (literalLength + 1 == optLen) {  // add null byte
                 thestring.append("\0", 1);