Browse Source

morphos: do not read beyond end of the .rela.stabs section. do not try to relocate stabs entries, if opening the stabs was unsuccessful

git-svn-id: trunk@41090 -
Károly Balogh 6 years ago
parent
commit
d1a097f6c3
1 changed files with 3 additions and 2 deletions
  1. 3 2
      rtl/morphos/lineinfo.pp

+ 3 - 2
rtl/morphos/lineinfo.pp

@@ -234,7 +234,7 @@ begin
       origpos:=filepos(e.f);
       seek(e.f,relocofs);
       readlen:=min(relocleft,maxstabsreloc*sizeof(telf32_rela));
-      blockread(e.f,stabsreloc,maxstabsreloc*sizeof(telf32_rela),res);
+      blockread(e.f,stabsreloc,readlen,res);
       reloclen:=res div sizeof(telf32_rela);
       dec(relocleft,res);
       if reloclen <= 0 then
@@ -324,7 +324,8 @@ begin
      stabscnt:=stabsleft;
     blockread(e.f,stabs,stabscnt*sizeof(tstab),res);
     stabscnt:=res div sizeof(tstab);
-    relocastabsentries(@stabs,stabscnt);
+    if StabsNeedsRelocation then
+      relocastabsentries(@stabs,stabscnt);
     for i:=0 to stabscnt-1 do
      begin
        case stabs[i].ntype of