Browse Source

* fixed reading of OMF library dictionary

git-svn-id: trunk@31337 -
nickysn 10 years ago
parent
commit
3c0d83bd74
1 changed files with 7 additions and 4 deletions
  1. 7 4
      compiler/owomflib.pas

+ 7 - 4
compiler/owomflib.pas

@@ -373,7 +373,7 @@ implementation
       blocks: array of TBlock;
       blocks: array of TBlock;
       blocknr: Integer;
       blocknr: Integer;
       block: PBlock;
       block: PBlock;
-      ofs: Byte;
+      ofs: Integer;
       bucket: Integer;
       bucket: Integer;
       length_of_string: Byte;
       length_of_string: Byte;
       name: string;
       name: string;
@@ -384,14 +384,17 @@ implementation
       read(blocks[0],DictionarySizeInBlocks*SizeOf(TBlock));
       read(blocks[0],DictionarySizeInBlocks*SizeOf(TBlock));
       for blocknr:=0 to DictionarySizeInBlocks-1 do
       for blocknr:=0 to DictionarySizeInBlocks-1 do
         begin
         begin
-          block:=@blocks[blocknr];
+          block:=@(blocks[blocknr]);
           for bucket:=0 to nbuckets-1 do
           for bucket:=0 to nbuckets-1 do
             if block^[bucket]<>0 then
             if block^[bucket]<>0 then
               begin
               begin
-                ofs:=block^[bucket];
+                ofs:=2*block^[bucket];
                 length_of_string:=block^[ofs];
                 length_of_string:=block^[ofs];
                 if (ofs+1+length_of_string+1)>High(TBlock) then
                 if (ofs+1+length_of_string+1)>High(TBlock) then
-                  Comment(V_Error,'OMF dictionary entry goes beyond end of block');
+                  begin
+                    Comment(V_Error,'OMF dictionary entry goes beyond end of block');
+                    continue;
+                  end;
                 SetLength(name,length_of_string);
                 SetLength(name,length_of_string);
                 Move(block^[ofs+1],name[1],length_of_string);
                 Move(block^[ofs+1],name[1],length_of_string);
                 PageNum:=block^[ofs+1+length_of_string]+
                 PageNum:=block^[ofs+1+length_of_string]+