Skip to content

Commit

Permalink
Added tests that demonstrate the out of memory problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Burke committed Jun 22, 2010
1 parent 9d6b1ab commit f02f758
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions GitSharp.Tests/GitSharp.Core/Util/Md5MessageDigestTest.cs
Expand Up @@ -70,6 +70,20 @@ public void LongStringOneUpdate()
Assert.IsTrue(expected.SequenceEqual(result));
}

[Test]
public void BlowTheHeap()
{
Assert.DoesNotThrow(() =>
{
MessageDigest md = CreateSUT();
var bytes = new byte[10000];
for (int i = 0; i < 100000; i++)
{
md.Update(bytes);
}
});
}

private static MessageDigest CreateSUT()
{
return MessageDigest.getInstance("MD5");
Expand Down
14 changes: 14 additions & 0 deletions GitSharp.Tests/GitSharp.Core/Util/Sha1MessageDigestTest.cs
Expand Up @@ -70,6 +70,20 @@ public void LongStringOneUpdate()
Assert.IsTrue(expected.SequenceEqual(result));
}

[Test]
public void BlowTheHeap()
{
Assert.DoesNotThrow(() =>
{
MessageDigest md = CreateSUT();
var bytes = new byte[10000];
for (int i = 0; i < 100000; i++)
{
md.Update(bytes);
}
});
}

private static MessageDigest CreateSUT()
{
return MessageDigest.getInstance("SHA-1");
Expand Down

0 comments on commit f02f758

Please sign in to comment.