From 864f3dc023b13e40559e21f126725f58231c21fa Mon Sep 17 00:00:00 2001 From: Alastair Houghton Date: Fri, 14 Feb 2025 14:59:20 +0000 Subject: [PATCH] [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 --- docs/CompactImageMapFormat.md | 2 +- stdlib/public/RuntimeModule/CompactImageMap.swift | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/CompactImageMapFormat.md b/docs/CompactImageMapFormat.md index a7a92bff85d..1e1810b279b 100644 --- a/docs/CompactImageMapFormat.md +++ b/docs/CompactImageMapFormat.md @@ -106,7 +106,7 @@ need to be stored in CIF data: | 8 | `/System/Applications` | | 9 | `/Applications` | | 10 | `C:\Windows\System32` | -| 11 | `C:\Program Files\` | +| 11 | `C:\Program Files` | Codes below 32 are reserved for future expansion of the fixed list. diff --git a/stdlib/public/RuntimeModule/CompactImageMap.swift b/stdlib/public/RuntimeModule/CompactImageMap.swift index f76233ebbdd..3f0d57354c2 100644 --- a/stdlib/public/RuntimeModule/CompactImageMap.swift +++ b/stdlib/public/RuntimeModule/CompactImageMap.swift @@ -244,7 +244,7 @@ public enum CompactImageMapFormat { if (byte & 0x40) == 0 { code = Int(byte & 0x3f) } else { - let byteCount = Int(byte & 0x3f) + let byteCount = Int(byte & 0x3f) + 1 code = 0 for _ in 0..