Browse Source

Avoid out of range access to instab array

Pierre Muller 3 tháng trước cách đây
mục cha
commit
f579f6dba5
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      compiler/x86/aasmcpu.pas

+ 6 - 1
compiler/x86/aasmcpu.pas

@@ -909,6 +909,8 @@ implementation
                       exit;
                   end;
                 inc(i);
+                if i>high(instab) then
+                  exit;
                 insentry:=@instab[i];
               end;
           end;
@@ -1997,7 +1999,10 @@ implementation
                result:=true;
                exit;
              end;
-           inc(insentry);
+           inc(i);
+           if i>high(instab) then
+             exit;
+           insentry:=@instab[i];
          end;
         Message1(asmw_e_invalid_opcode_and_operands,GetString);
         { No instruction found, set insentry to nil and inssize to -1 }