فهرست منبع

tai_aggregatetypedconst.add_to_string: fix off-by-one errors

Jonas Maebe 4 ماه پیش
والد
کامیت
f0cecf5367
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      compiler/aasmcnst.pas

+ 3 - 3
compiler/aasmcnst.pas

@@ -740,7 +740,7 @@ implementation
              lent:=len1+len2;
              SetLength(strtai.str,lent+1);
              { also copy null terminator }
-             move(lother_string.str[0],strtai.str[len1+1],len2+1);
+             move(lother_string.str[0],strtai.str[len1],len2+1);
            end;
          ait_const:
            begin
@@ -749,8 +749,8 @@ implementation
              { it was already len+1 to hold the #0 -> realloc to len+2 }
              len1:=length(strtai.str);
              SetLength(strtai.str,len1+1);
-             strtai.str[len1]:=ansichar(tai_const(othertai).value);
-             strtai.str[len1+1]:=#0;
+             strtai.str[len1-1]:=ansichar(tai_const(othertai).value);
+             strtai.str[len1]:=#0;
            end;
          else
            internalerror(2014070102);