Skip to content

Commit 864f3dc

Browse files
committed
[Backtracing] Fix bug in Compact Image Map decoder.
The `expand` opcode was being decoded incorrectly in the case where we were trying to expand prefixes with codes of 64 or above. rdar://144497804
1 parent 5c1a02a commit 864f3dc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/CompactImageMapFormat.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ need to be stored in CIF data:
106106
| 8 | `/System/Applications` |
107107
| 9 | `/Applications` |
108108
| 10 | `C:\Windows\System32` |
109-
| 11 | `C:\Program Files\` |
109+
| 11 | `C:\Program Files` |
110110

111111
Codes below 32 are reserved for future expansion of the fixed list.
112112

stdlib/public/RuntimeModule/CompactImageMap.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,15 @@ public enum CompactImageMapFormat {
244244
if (byte & 0x40) == 0 {
245245
code = Int(byte & 0x3f)
246246
} else {
247-
let byteCount = Int(byte & 0x3f)
247+
let byteCount = Int(byte & 0x3f) + 1
248248
code = 0
249249
for _ in 0..<byteCount {
250250
guard let byte = iterator.next() else {
251251
return nil
252252
}
253253
code = (code << 8) | Int(byte)
254254
}
255+
code += 64
255256
}
256257

257258
#if DEBUG_COMPACT_IMAGE_MAP

0 commit comments

Comments
 (0)