Bläddra i källkod

+ check bounds for SymIndex of SYMTAB_DATA symbols

Nikolay Nikolov 1 år sedan
förälder
incheckning
e569863a1a
1 ändrade filer med 5 tillägg och 0 borttagningar
  1. 5 0
      compiler/ogwasm.pas

+ 5 - 0
compiler/ogwasm.pas

@@ -2422,6 +2422,11 @@ implementation
                                     InputError('Error reading the data segment index of a SYMTAB_DATA symbol');
                                     InputError('Error reading the data segment index of a SYMTAB_DATA symbol');
                                     exit;
                                     exit;
                                   end;
                                   end;
+                                if SymIndex>high(DataSegments) then
+                                  begin
+                                    InputError('Data segment index of SYMTAB_DATA symbol out of bounds');
+                                    exit;
+                                  end;
                                 if not ReadUleb32(SymOffset) then
                                 if not ReadUleb32(SymOffset) then
                                   begin
                                   begin
                                     InputError('Error reading the offset of a SYMTAB_DATA symbol');
                                     InputError('Error reading the offset of a SYMTAB_DATA symbol');