diff --git a/WebAssembly/Module.cs b/WebAssembly/Module.cs index 7e679936..6d5509da 100644 --- a/WebAssembly/Module.cs +++ b/WebAssembly/Module.cs @@ -348,6 +348,12 @@ public static Module ReadFromBinary(Stream input) } break; + case Section.DataCount: //Optional section, indicates the expected length of the data segment vector + { + reader.ReadUInt32(); + } + break; + default: throw new ModuleLoadException($"Unrecognized section type {id}.", preSectionOffset); } diff --git a/WebAssembly/Section.cs b/WebAssembly/Section.cs index f34f877a..47ecd01c 100644 --- a/WebAssembly/Section.cs +++ b/WebAssembly/Section.cs @@ -1,4 +1,6 @@ -namespace WebAssembly; +using System; + +namespace WebAssembly; /// /// The standard section identifiers. @@ -52,10 +54,14 @@ public enum Section : byte /// /// Data segments. /// - Data + Data, + /// + /// Optional segment which indicates the number of sata segments + /// + DataCount, } static class SectionExtensions { - public static bool IsValid(this Section section) => section <= Section.Data; + public static bool IsValid(this Section section) => section <= Section.DataCount; }