Skip to content

Commit 7b32ffe

Browse files
committed
[swift-inspect] Limit number of jobs printed on an actor.
If we encounter bad data in the target, we could end up trying to print an infinite list of jobs. Clamp it to 1,000 so we fail more gracefully. rdar://113417637
1 parent 7020cf3 commit 7b32ffe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/swift-inspect/Sources/swift-inspect/Operations/DumpConcurrency.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,17 @@ fileprivate class ConcurrencyDumper {
421421
print(" no jobs queued")
422422
} else {
423423
print(" job queue: \(jobStr(job))")
424-
while job != 0 {
424+
let limit = 1000
425+
for i in 1 ... limit {
425426
job = swift_reflection_nextJob(context, job);
426427
if job != 0 {
427428
print(" \(jobStr(job))")
429+
} else {
430+
break
431+
}
432+
433+
if i == limit {
434+
print(" ...truncated...")
428435
}
429436
}
430437
}

0 commit comments

Comments
 (0)