Skip to content

Commit 324bb4c

Browse files
Dominik KlembaV8-internal LUCI CQ
authored andcommitted
Refactor: Simplify static offset calculation in ProgramBuilder
This is possible after commit cb77273, which added support for random index generation for small integer ranges. Change-Id: Iebc491eb860fcdf29f4fa6e4d65cbecff5cd831d Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/8447076 Reviewed-by: Matthias Liedtke <[email protected]> Commit-Queue: Dominik Klemba <[email protected]>
1 parent cb77273 commit 324bb4c

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

Sources/Fuzzilli/Base/ProgramBuilder.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3877,12 +3877,7 @@ public class ProgramBuilder {
38773877
// Generate an in-bounds offset (dynamicOffset + staticOffset) into the memory.
38783878
let dynamicOffsetValue = self.randomNonNegativeIndex(upTo: memSize)
38793879
let dynamicOffset = function.memoryArgument(dynamicOffsetValue, memoryTypeInfo)
3880-
var staticOffset: Int64
3881-
if (dynamicOffsetValue == memSize) {
3882-
staticOffset = 0
3883-
} else {
3884-
staticOffset = self.randomNonNegativeIndex(upTo: memSize) % (memSize - dynamicOffsetValue)
3885-
}
3880+
let staticOffset = self.randomNonNegativeIndex(upTo: memSize - dynamicOffsetValue)
38863881

38873882
return (dynamicOffset, staticOffset)
38883883
}

0 commit comments

Comments
 (0)