Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #435 from AndrejMitrovic/Fixup3851
Browse files Browse the repository at this point in the history
Fixup 3851 - Buffer length needs to fit size_t.max
  • Loading branch information
alexrp committed Mar 8, 2013
2 parents f799ce9 + a914e97 commit 79ad6b3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/rt/arrayassign.d
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ extern (C) void[] _d_arrayassign(TypeInfo ti, void[] from, void[] to)

if (to.length != from.length)
{
char[10] tmp1 = void;
char[10] tmp2 = void;
enum len = is(size_t == uint) ? 10 : 20;
char[len] tmp1 = void;
char[len] tmp2 = void;
string msg = "lengths don't match for array copy, "c;
msg ~= tmp1.uintToString(to.length) ~ " = " ~ tmp2.uintToString(from.length);
throw new Error(msg);
Expand Down Expand Up @@ -90,7 +91,8 @@ extern (C) void[] _d_arrayctor(TypeInfo ti, void[] from, void[] to)

if (to.length != from.length)
{
char[10] tmp = void;
enum len = is(size_t == uint) ? 10 : 20;
char[len] tmp = void;
string msg = "lengths don't match for array initialization,"c;
msg ~= tmp.uintToString(to.length) ~ " = " ~ tmp.uintToString(from.length);
throw new Error(msg);
Expand Down

0 comments on commit 79ad6b3

Please sign in to comment.