Bladeren bron

* Fetch PECOFF section sizes correctly (not including zero padding), resolves #22788.

git-svn-id: trunk@22879 -
sergei 12 jaren geleden
bovenliggende
commit
47cd83ae14
1 gewijzigde bestanden met toevoegingen van 10 en 0 verwijderingen
  1. 10 0
      rtl/inc/exeinfo.pp

+ 10 - 0
rtl/inc/exeinfo.pp

@@ -379,7 +379,17 @@ begin
      if asecname=secname then
      if asecname=secname then
        begin
        begin
          secofs:=cardinal(sechdr.datapos) + E.ImgOffset;
          secofs:=cardinal(sechdr.datapos) + E.ImgOffset;
+{$ifdef GO32V2}
          seclen:=sechdr.datalen;
          seclen:=sechdr.datalen;
+{$else GO32V2}
+         { In PECOFF, datalen includes file padding up to the next section.
+           vsize is the actual payload size if it does not exceed datalen,
+           otherwise it is .bss (or alike) section that we should ignore.  }
+         if sechdr.vsize<=sechdr.datalen then
+           seclen:=sechdr.vsize
+         else
+           exit;
+{$endif GO32V2}
          FindSectionCoff:=true;
          FindSectionCoff:=true;
          exit;
          exit;
        end;
        end;