1package binary
2
3import (
4 "bytes"
5
6 "github.com/tetratelabs/wazero/internal/wasm"
7)
8
9// decodeCustomSection deserializes the data **not** associated with the "name" key in SectionIDCustom.
10//
11// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#custom-section%E2%91%A0
12func decodeCustomSection(r *bytes.Reader, name string, limit uint64) (result *wasm.CustomSection, err error) {
13 buf := make([]byte, limit)
14 _, err = r.Read(buf)
15
16 result = &wasm.CustomSection{
17 Name: name,
18 Data: buf,
19 }
20
21 return
22}