Ver Fonte

Avoid writing characters after sym.value.len for conststring constant symbols

git-svn-id: trunk@48688 -
pierre há 4 anos atrás
pai
commit
6a408fe97e
1 ficheiros alterados com 8 adições e 4 exclusões
  1. 8 4
      compiler/dbgstabs.pas

+ 8 - 4
compiler/dbgstabs.pas

@@ -1609,10 +1609,14 @@ implementation
           conststring:
             begin
               if sym.value.len<200 then
-                if target_dbg.id=dbg_stabs then
-                  st:='s'''+backspace_quote(octal_quote(strpas(pchar(sym.value.valueptr)),[#0..#9,#11,#12,#14..#31,'''']),['"','\',#10,#13])+''''
-                else
-                  st:='s'''+stabx_quote_const(octal_quote(strpas(pchar(sym.value.valueptr)),[#0..#9,#11,#12,#14..#31,'''']))+''''
+                begin
+                  s:=strpas(pchar(sym.value.valueptr));
+                  s:=copy(s,1,sym.value.len);
+                  if target_dbg.id=dbg_stabs then
+                    st:='s'''+backspace_quote(octal_quote(s,[#0..#9,#11,#12,#14..#31,'''']),['"','\',#10,#13])+''''
+                  else
+                    st:='s'''+stabx_quote_const(octal_quote(s,[#0..#9,#11,#12,#14..#31,'''']))+'''';
+                end
               else
                 st:='<constant string too long>';
             end;