Skip to content

Commit 166ba17

Browse files
committed
fix: parsing of samples with atypical header size
1 parent abc1843 commit 166ba17

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

binxml.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ func ParseXml(r io.Reader, enc ManifestEncoder, resources *ResourceTable) error
6161

6262
defer x.encoder.Flush()
6363

64-
totalLen -= chunkHeaderSize
64+
totalLen -= uint32(headerLen)
65+
// 29f82928c630897576aa0c9c3d2f36d722a94ec574bd5ca4aaf4ba5f9d014a32
66+
io.CopyN(ioutil.Discard, r, int64(headerLen)-chunkHeaderSize)
6567

6668
var len uint32
6769
var lastId uint16
6870
for i := uint32(0); i < totalLen; i += len {
69-
id, _, len, err = parseChunkHeader(r)
71+
id, headerLen, len, err = parseChunkHeader(r)
7072
if err != nil {
7173
return fmt.Errorf("Error parsing header at 0x%08x of 0x%08x %08x: %s", i, totalLen, lastId, err.Error())
7274
}

0 commit comments

Comments
 (0)