From 34b48df7a1b5d84147674be60ca917586db5d2bf Mon Sep 17 00:00:00 2001 From: Prakash Dalai <86671543+prakashUXtech@users.noreply.github.com> Date: Mon, 19 Oct 2026 13:10:22 +0530 Subject: [PATCH 1/2] fix(test): split the progressive restart fixture's byte chain so the macOS type checker finishes --- Tests/CoreRasterTests/JPEGReadTests.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/CoreRasterTests/JPEGReadTests.swift b/Tests/CoreRasterTests/JPEGReadTests.swift index a1989df8..0720cddc 100644 --- a/Tests/CoreRasterTests/JPEGReadTests.swift +++ b/Tests/CoreRasterTests/JPEGReadTests.swift @@ -208,7 +208,8 @@ import Foundation let dcScan = coded({ $0.put(dc, 3); $0.put(7, 3) }, { $0.put(dc, 3); $0.put(2, 3) }) let acScan = coded({ $0.put(ac, 0x10); $0.put(0, 1) }, { $0.put(ac, 0x02); $0.put(3, 2); $0.put(ac, 0x00) }) let head = F.header(f, sof: 0xC2, precision: 8, restart: 1, orientation: nil, littleEndian: false, ac: (F.acAll, F.acAll)) - let data = Data(head + F.sos([0], 0, 0, 0, 0) + dcScan + F.sos([0], 1, 63, 0, 0) + acScan + [0xFF, 0xD9]) + let parts: [[UInt8]] = [head, F.sos([0], 0, 0, 0, 0), dcScan, F.sos([0], 1, 63, 0, 0), acScan, [0xFF, 0xD9]] + let data = Data(Array(parts.joined())) #expect(try JPEG.read(data) == JPEG.read(F.baseline(f))) } From 6589f38ad392ec14c515011771044bc69723db1d Mon Sep 17 00:00:00 2001 From: Prakash Dalai <86671543+prakashUXtech@users.noreply.github.com> Date: Mon, 19 Oct 2026 13:19:23 +0530 Subject: [PATCH 2/2] fix(test): split the JPEG guard fixture's byte chains the same way --- Tests/CoreRasterTests/JPEGReadGuardTests.swift | 10 +++++++--- Tests/CoreRasterTests/JPEGReadTests.swift | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Tests/CoreRasterTests/JPEGReadGuardTests.swift b/Tests/CoreRasterTests/JPEGReadGuardTests.swift index 515d642e..0311a12e 100644 --- a/Tests/CoreRasterTests/JPEGReadGuardTests.swift +++ b/Tests/CoreRasterTests/JPEGReadGuardTests.swift @@ -82,9 +82,13 @@ import Foundation @Test func shortScanNamed() { let f = F.Frame(width: 8, height: 8, block: F.seeded(0)) let two = F.Huffman(bits: [2] + [Int](repeating: 0, count: 15), values: [0, 0]) - let sof = F.segment(0xC0, [8] + F.be16(8) + F.be16(8) + [1, 1, 0x11, 0]) - let head = [0xFF, 0xD8] + F.dqt(0, f.tables[0]) + sof + F.dht(0, 0, two) + F.dht(1, 0, two) - let text = damagedText { try JPEG.read(Data(head + F.sos([0], 0, 63, 0, 0) + [0xFF, 0xD9])) } + // Built as lists of parts: one long `+` chain times out the macOS type checker. + let frame: [[UInt8]] = [[8], F.be16(8), F.be16(8), [1, 1, 0x11, 0]] + let sof = F.segment(0xC0, Array(frame.joined())) + let parts: [[UInt8]] = [[0xFF, 0xD8], F.dqt(0, f.tables[0]), sof, F.dht(0, 0, two), F.dht(1, 0, two), + F.sos([0], 0, 63, 0, 0), [0xFF, 0xD9]] + let data = Data(Array(parts.joined())) + let text = damagedText { try JPEG.read(data) } #expect(text?.contains("scan ends at MCU 0") == true, "\(text ?? "no damaged")") } diff --git a/Tests/CoreRasterTests/JPEGReadTests.swift b/Tests/CoreRasterTests/JPEGReadTests.swift index 0720cddc..ece41b09 100644 --- a/Tests/CoreRasterTests/JPEGReadTests.swift +++ b/Tests/CoreRasterTests/JPEGReadTests.swift @@ -208,6 +208,7 @@ import Foundation let dcScan = coded({ $0.put(dc, 3); $0.put(7, 3) }, { $0.put(dc, 3); $0.put(2, 3) }) let acScan = coded({ $0.put(ac, 0x10); $0.put(0, 1) }, { $0.put(ac, 0x02); $0.put(3, 2); $0.put(ac, 0x00) }) let head = F.header(f, sof: 0xC2, precision: 8, restart: 1, orientation: nil, littleEndian: false, ac: (F.acAll, F.acAll)) + // Built as a list of parts: one long `+` chain times out the macOS type checker. let parts: [[UInt8]] = [head, F.sos([0], 0, 0, 0, 0), dcScan, F.sos([0], 1, 63, 0, 0), acScan, [0xFF, 0xD9]] let data = Data(Array(parts.joined())) #expect(try JPEG.read(data) == JPEG.read(F.baseline(f)))