Skip to content

Commit 1617eaa

Browse files
authored
Merge pull request #4 from ycdxsb/master
fix an error in function replace_insns and the issue comes from a mmh version difference
2 parents 18cdd6c + 4f57fc6 commit 1617eaa

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

kafl_fuzzer/common/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def get_dependency(self, ioctl):
279279
return None
280280
else:
281281

282-
while True:
282+
for _ in range(100):
283283
num = random.choice(self.dependency[target_index])
284284
if num==ioctl:
285285
continue

kafl_fuzzer/technique/havoc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def replace_insns(irp_list, func):
134134
new_irp_list.append(rand.select(appended_target_list))
135135

136136
pos = rand.int(len(irp_list))
137-
new_irp_list = irp_list[:pos]+ new_irp_list.pop() + irp_list[pos+1:]
137+
new_irp_list = irp_list[:pos]+ new_irp_list + irp_list[pos+1:]
138138
func(new_irp_list)
139139
new_irp_list.clear()
140140

@@ -256,4 +256,4 @@ def get_valid_length(target, IoControlCode):
256256

257257
target.InBuffer_length = origin_InBufferLength
258258
target.OutBuffer_length = origin_OutBufferLength
259-
target.InBuffer = origin_InBuffer
259+
target.InBuffer = origin_InBuffer

kafl_fuzzer/worker/execution_result.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def hash(self, pre_lut=False):
6363
assert not pre_lut, "Request pre-LUT hash but LUT has been applied already."
6464
else:
6565
self.apply_lut()
66-
return "%016x" % mmh3.hash64(self.cbuffer, seed=0xaaaaaaaa, x64arch=True, signed=False)[0]
66+
return "%016x" % mmh3.hash64(bytes(self.cbuffer), seed=0xaaaaaaaa, x64arch=True, signed=False)[0]
6767

6868
def apply_lut(self):
6969
if not self.lut_applied:

0 commit comments

Comments
 (0)