Browse Source

* WebAssembly internal linker: fixed bug, when reading very large (in absolute
value) signed negative LEB128 numbers (encoded as 10 bytes). It is very
unlikely for this to have presented a problem in practice on the 32-bit
WebAssembly platforms, since reading signed LEB numbers is only used for
reading the initial value of WebAssembly globals in external modules, and the
affected values are unlikely, but it is still bug, which is why I'm fixing it.

Nikolay Nikolov 2 weeks ago
parent
commit
f9608e8506
1 changed files with 1 additions and 1 deletions
  1. 1 1
      compiler/ogwasm.pas

+ 1 - 1
compiler/ogwasm.pas

@@ -592,7 +592,7 @@ implementation
 {$define rangeon}
 {$R-}
 {$endif}
-        if (b and 64)<>0 then
+        if ((b and 64)<>0) and (Shift < 64) then
           result:=result or (high(uint64) shl shift);
       end;
 {$ifdef overflowon}