Skip to content

Commit ff8f8c9

Browse files
author
Samuel Groß
committed
Add Array.prototype.at to JS environment model
Drive-by: make an assertion in PostProcessor.swift more specific
1 parent 2459133 commit ff8f8c9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Sources/Fuzzilli/Core/JavaScriptEnvironment.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public extension JSType {
314314
static let jsPlainObject = JSType.object(ofGroup: "Object", withProperties: ["__proto__"])
315315

316316
/// Type of a JavaScript array.
317-
static let jsArray = JSType.iterable + JSType.object(ofGroup: "Array", withProperties: ["__proto__", "length", "constructor"], withMethods: ["concat", "copyWithin", "fill", "find", "findIndex", "pop", "push", "reverse", "shift", "unshift", "slice", "sort", "splice", "includes", "indexOf", "keys", "entries", "forEach", "filter", "map", "every", "some", "reduce", "reduceRight", "toString", "toLocaleString", "join", "lastIndexOf", "values", "flat", "flatMap"])
317+
static let jsArray = JSType.iterable + JSType.object(ofGroup: "Array", withProperties: ["__proto__", "length", "constructor"], withMethods: ["at", "concat", "copyWithin", "fill", "find", "findIndex", "pop", "push", "reverse", "shift", "unshift", "slice", "sort", "splice", "includes", "indexOf", "keys", "entries", "forEach", "filter", "map", "every", "some", "reduce", "reduceRight", "toString", "toLocaleString", "join", "lastIndexOf", "values", "flat", "flatMap"])
318318

319319
/// Type of a JavaScript Map object.
320320
static let jsMap = JSType.iterable + JSType.object(ofGroup: "Map", withProperties: ["__proto__", "size"], withMethods: ["clear", "delete", "entries", "forEach", "get", "has", "keys", "set", "values"])
@@ -579,6 +579,7 @@ public extension ObjectGroup {
579579
"constructor" : .jsFunction([.integer] => .jsArray),
580580
],
581581
methods: [
582+
"at" : [.integer] => .unknown,
582583
"copyWithin" : [.integer, .integer, .opt(.integer)] => .jsArray,
583584
"entries" : [] => .jsArray,
584585
"every" : [.function(), .opt(.object())] => .boolean,

Sources/Fuzzilli/Minimization/PostProcessor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct MinimizationPostProcessor {
8484
for change in changes {
8585
// Either we're adding a new instruction (in which case we're replacing a nop inserted in step 1), or changing the number of inputs of an existing instruction.
8686
assert((code[change.index].op is Nop && !(change.newInstruction.op is Nop)) ||
87-
(code[change.index].op.name == change.newInstruction.op.name && code[change.index].numInputs != change.newInstruction.numInputs))
87+
(code[change.index].op.name == change.newInstruction.op.name && code[change.index].numInputs < change.newInstruction.numInputs))
8888
helper.tryReplacing(instructionAt: change.index, with: change.newInstruction, in: &code)
8989
}
9090

0 commit comments

Comments
 (0)