瀏覽代碼

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);