From 0f9b0b581e66dd47a242d25838950ffffb4371a8 Mon Sep 17 00:00:00 2001 From: kelly Date: Thu, 5 Jan 2023 10:03:36 -0800 Subject: [PATCH 1/2] Fix XML parsing in WASI environment Final chunk of XML document was being skipped when parsing when in a WASI environment --- Sources/FoundationXML/XMLParser.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Sources/FoundationXML/XMLParser.swift b/Sources/FoundationXML/XMLParser.swift index befc828212..d7b2f45a60 100644 --- a/Sources/FoundationXML/XMLParser.swift +++ b/Sources/FoundationXML/XMLParser.swift @@ -601,10 +601,7 @@ open class XMLParser : NSObject { var result = true var chunkStart = 0 var chunkEnd = min(_chunkSize, data.count) - while result { - if chunkStart >= data.count || chunkEnd >= data.count { - break - } + while result && chunkStart != chunkEnd { let chunk = data[chunkStart.. Date: Thu, 2 Feb 2023 16:10:31 +0000 Subject: [PATCH 2/2] Update XMLParser.swift --- Sources/FoundationXML/XMLParser.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/FoundationXML/XMLParser.swift b/Sources/FoundationXML/XMLParser.swift index d7b2f45a60..501c9670a1 100644 --- a/Sources/FoundationXML/XMLParser.swift +++ b/Sources/FoundationXML/XMLParser.swift @@ -601,7 +601,7 @@ open class XMLParser : NSObject { var result = true var chunkStart = 0 var chunkEnd = min(_chunkSize, data.count) - while result && chunkStart != chunkEnd { + while result && chunkStart < chunkEnd { let chunk = data[chunkStart..