We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 671db08 commit 5a277d4Copy full SHA for 5a277d4
tools/swift-inspect/Sources/SwiftInspectLinux/Process.swift
@@ -61,6 +61,7 @@ public class Process {
61
62
// read an array of type T elements from the target process
63
public func readArray<T>(address: UInt64, upToCount: UInt) throws -> [T] {
64
+ guard upToCount > 0 else { return [] }
65
let maxSize = upToCount * UInt(MemoryLayout<T>.stride)
66
let array: [T] = Array(unsafeUninitializedCapacity: Int(upToCount)) { buffer, initCount in
67
var local = iovec(iov_base: buffer.baseAddress!, iov_len: Int(maxSize))
0 commit comments