Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions WebAssembly/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
12 changes: 9 additions & 3 deletions WebAssembly/Section.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace WebAssembly;
using System;

namespace WebAssembly;

/// <summary>
/// The standard section identifiers.
Expand Down Expand Up @@ -52,10 +54,14 @@ public enum Section : byte
/// <summary>
/// Data segments.
/// </summary>
Data
Data,
/// <summary>
/// Optional segment which indicates the number of sata segments
/// </summary>
DataCount,
}

static class SectionExtensions
{
public static bool IsValid(this Section section) => section <= Section.Data;
public static bool IsValid(this Section section) => section <= Section.DataCount;
}