Browse Source

Set string length before calling move to avoid problems with global data analysis on systems using C library

git-svn-id: trunk@49280 -
pierre 4 years ago
parent
commit
77e3a402da
2 changed files with 5 additions and 1 deletions
  1. 1 1
      compiler/assemble.pas
  2. 4 0
      compiler/ogcoff.pas

+ 1 - 1
compiler/assemble.pas

@@ -1403,8 +1403,8 @@ Implementation
                   len:=p-pstart;
                   if len>255 then
                     internalerror(200509187);
-                  move(pstart^,hs[1],len);
                   hs[0]:=chr(len);
+                  move(pstart^,hs[1],len);
                   sym:=objdata.symbolref(hs);
                   { Second symbol? }
                   if assigned(relocsym) then

+ 4 - 0
compiler/ogcoff.pas

@@ -2063,6 +2063,8 @@ const pemagic : array[0..3] of byte = (
                   FCoffSyms.Read(bosym,sizeof(bosym));
                   if bosym.Name.Offset.Zeroes<>0 then
                     begin
+                      { Added for sake of global data analysis }
+                      strname[0]:=#0;
                       move(bosym.Name.ShortName,strname[1],8);
                       strname[9]:=#0;
                       strname[0]:=chr(strlen(@strname[1]));
@@ -2081,6 +2083,8 @@ const pemagic : array[0..3] of byte = (
                   FCoffSyms.Read(sym,sizeof(sym));
                   if plongint(@sym.name)^<>0 then
                     begin
+                      { Added for sake of global data analysis }
+                      strname[0]:=#0;
                       move(sym.name,strname[1],8);
                       strname[9]:=#0;
                       strname[0]:=chr(strlen(@strname[1]));