Browse Source

Fix variable i range of values in class function TObject.GetInterfaceEntry(const iid : tguid) : pinterfaceentry;

lag programming 4 months ago
parent
commit
ee79324b57
1 changed files with 6 additions and 3 deletions
  1. 6 3
      rtl/inc/objpas.inc

+ 6 - 3
rtl/inc/objpas.inc

@@ -1067,7 +1067,7 @@ end;
 
       class function TObject.GetInterfaceEntry(const iid : tguid) : pinterfaceentry;
         var
-          i: longint;
+          i: sizeuint;
           intftable: pinterfacetable;
           ovmt: PVmt;
         begin
@@ -1075,11 +1075,14 @@ end;
           while Assigned(ovmt) and Assigned(ovmt^.vIntftable) do
           begin
             intftable:=ovmt^.vIntfTable;
-            for i:=0 to intftable^.EntryCount-1 do
+            i:=intftable^.EntryCount;
+            result:=@intftable^.Entries[0];
+            while i>0 do
             begin
-              result:=@intftable^.Entries[i];
               if assigned(Result^.iid) and IsGUIDEqual(Result^.iid^,iid) then
                 Exit;
+              inc(Result);
+              dec(i);
             end;
             ovmt := ovmt^.vParent;
           end;