diff options
author | Heiko Eißfeldt <heikoi@hexco.de> | 2019-06-12 17:20:25 +0200 |
---|---|---|
committer | Heiko Eißfeldt <heikoi@hexco.de> | 2019-06-12 17:20:25 +0200 |
commit | 1c2ed83960fd79727d0f34b11ee361c37c953923 (patch) | |
tree | f112f5afedbeab2df5cb6a3fdd3d29e44b3cded5 /llvm_mode/compare-transform-pass.so.cc | |
parent | bcc0347eefa05275cea221f8baad8abe7e091872 (diff) | |
download | afl++-1c2ed83960fd79727d0f34b11ee361c37c953923.tar.gz |
bugfixes from pbst for laf-intel transformations
Diffstat (limited to 'llvm_mode/compare-transform-pass.so.cc')
-rw-r--r-- | llvm_mode/compare-transform-pass.so.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm_mode/compare-transform-pass.so.cc b/llvm_mode/compare-transform-pass.so.cc index 54d33e18..c89655ea 100644 --- a/llvm_mode/compare-transform-pass.so.cc +++ b/llvm_mode/compare-transform-pass.so.cc @@ -144,7 +144,7 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp, const if (!isStrcmp && !isMemcmp && !isStrncmp && !isStrcasecmp && !isStrncasecmp) continue; - /* is a str{n,}{case,}cmp/memcmp, check is we have + /* is a str{n,}{case,}cmp/memcmp, check if we have * str{case,}cmp(x, "const") or str{case,}cmp("const", x) * strn{case,}cmp(x, "const", ..) or strn{case,}cmp("const", x, ..) * memcmp(x, "const", ..) or memcmp("const", x, ..) */ @@ -211,6 +211,13 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp, const VarStr = Str1P; constLen = isMemcmp ? sizedLen : GetStringLength(Str2P); } + + /* bugfix thanks to pbst */ + /* ignore terminating '\0' in string for strcmp */ + if (!isSizedcmp && constLen > 0) { + constLen--; + } + if (isSizedcmp && constLen > sizedLen) { constLen = sizedLen; } |