Skip to content

Commit 0ef67b2

Browse files
LiedtkeV8-internal LUCI CQ
authored andcommitted
DetectMissingBuiltins: Filter out inaccessible builtins
There is a large amount of properties on prototype objects that can only be called on a proper instance, e.g. trying to access > DisposableStack.prototype.disposed will throw an error as DisposableStack.prototype is not the expected receiver type (unlike new DisposableStack().disposed). While the property exists on the prototype, it should not be registered as the fuzzer can't really do anything useful with something that always throws. Bug: 487347678 Change-Id: Ie8b2e5d30caa819f512d6791afb1a22d11761c7f Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/9058839 Reviewed-by: Danylo Mocherniuk <mdanylo@google.com> Commit-Queue: Matthias Liedtke <mliedtke@google.com>
1 parent bf485ca commit 0ef67b2

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

Sources/FuzzilliDetectMissingBuiltins/main.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ do {
149149

150150
var visited = Set<Int>()
151151
var missingBuiltins = [String]()
152+
var potentiallyBroken = [String]()
152153

153154
func checkNode(_ nodeId: Int, path: [String]) {
154155
if visited.contains(nodeId) { return }
@@ -195,8 +196,15 @@ func checkNode(_ nodeId: Int, path: [String]) {
195196
isRegistered = jsEnvironment.hasBuiltin(prop)
196197
}
197198

198-
if !isRegistered {
199+
// Some properties exist but aren't "accessible", e.g. a lot of getters exist on the
200+
// prototype but they can only be called on a receiver, e.g.
201+
// DisposableStack.prototype.disposed.
202+
let isAccessible = graph[childId]?.type != "error"
203+
204+
if !isRegistered && isAccessible {
199205
missingBuiltins.append(pathString)
206+
} else if isRegistered && !isAccessible {
207+
potentiallyBroken.append(pathString)
200208
}
201209

202210
checkNode(childId, path: newPath)
@@ -205,3 +213,7 @@ func checkNode(_ nodeId: Int, path: [String]) {
205213

206214
checkNode(0, path: [])
207215
print(missingBuiltins.sorted().joined(separator: "\n"))
216+
if !potentiallyBroken.isEmpty {
217+
print("\nPotentially inaccessible but registered builtins: ")
218+
print(potentiallyBroken.sorted().joined(separator: "\n"))
219+
}

0 commit comments

Comments
 (0)