Skip to content

Commit f0d24bf

Browse files
committed
Avoid invalid index slices in creating mirrors
1 parent 95bd083 commit f0d24bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/SDK/Foundation/Data.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,7 @@ extension Data : CustomStringConvertible, CustomDebugStringConvertible, CustomRe
18621862

18631863
// Minimal size data is output as an array
18641864
if nBytes < 64 {
1865-
children.append((label: "bytes", value: Array(self[0..<nBytes])))
1865+
children.append((label: "bytes", value: Array(self[startIndex..<Swift.min(nBytes + startIndex, endIndex)])))
18661866
}
18671867

18681868
let m = Mirror(self, children:children, displayStyle: Mirror.DisplayStyle.struct)

0 commit comments

Comments
 (0)