From 8802c7d489d067ec1ba67b497fa29571701263d9 Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Tue, 26 Dec 2023 14:42:51 +0200 Subject: [PATCH] + parse and check the version of the 'linking' section --- compiler/ogwasm.pas | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/compiler/ogwasm.pas b/compiler/ogwasm.pas index 4d810450f6..bf3edea917 100644 --- a/compiler/ogwasm.pas +++ b/compiler/ogwasm.pas @@ -2232,8 +2232,22 @@ implementation end; function ReadLinkingSection: Boolean; + const + ExpectedVersion = 2; + var + Version: uint32; begin Result:=False; + if not ReadUleb32(Version) then + begin + InputError('Error reading the version of the ''linking'' subsection'); + exit; + end; + if Version<>ExpectedVersion then + begin + InputError('The ''linking'' subsection has an unsupported version (expected version ' + tostr(ExpectedVersion) + ', got version ' + tostr(Version) + ')'); + exit; + end; end; function ReadProducersSection: Boolean;