Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Varga <vargaz@gmail.com>2007-12-28 03:39:33 +0300
committerZoltan Varga <vargaz@gmail.com>2007-12-28 03:39:33 +0300
commit35a99a951119646112da812b08453b635f647917 (patch)
treecf3e3c8d688b6322fddfe141ed5a4a5d66d3672f /mcs/class/corlib/System.IO/MemoryStream.cs
parentec501c66b462ab1e78834e7e72b89d3350f41ad4 (diff)
2007-12-28 Zoltan Varga <vargaz@gmail.com>
* MemoryStream.cs: Fix crash if internalBuffer is null. Avoid calling unsafe icalls. Fixes #350860. svn path=/trunk/mcs/; revision=91971
Diffstat (limited to 'mcs/class/corlib/System.IO/MemoryStream.cs')
-rw-r--r--mcs/class/corlib/System.IO/MemoryStream.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/mcs/class/corlib/System.IO/MemoryStream.cs b/mcs/class/corlib/System.IO/MemoryStream.cs
index ed5b6f01655..61f65d39425 100644
--- a/mcs/class/corlib/System.IO/MemoryStream.cs
+++ b/mcs/class/corlib/System.IO/MemoryStream.cs
@@ -173,7 +173,7 @@ namespace System.IO
byte [] newBuffer = null;
if (value != 0) {
newBuffer = new byte [value];
- Buffer.BlockCopyInternal (internalBuffer, 0, newBuffer, 0, length);
+ Buffer.BlockCopy (internalBuffer, 0, newBuffer, 0, length);
}
internalBuffer = newBuffer; // It's null when capacity is set to 0
@@ -258,7 +258,7 @@ namespace System.IO
if (position > length - count)
count = length - position;
- Buffer.BlockCopyInternal (internalBuffer, position, buffer, offset, count);
+ Buffer.BlockCopy (internalBuffer, position, buffer, offset, count);
position += count;
return count;
}
@@ -360,7 +360,8 @@ namespace System.IO
int l = length - initialIndex;
byte[] outBuffer = new byte [l];
- Buffer.BlockCopyInternal (internalBuffer, initialIndex, outBuffer, 0, l);
+ if (internalBuffer != null)
+ Buffer.BlockCopy (internalBuffer, initialIndex, outBuffer, 0, l);
return outBuffer;
}
@@ -385,7 +386,7 @@ namespace System.IO
if (position > capacity - count)
Capacity = CalculateNewCapacity (position + count);
- Buffer.BlockCopyInternal (buffer, offset, internalBuffer, position, count);
+ Buffer.BlockCopy (buffer, offset, internalBuffer, position, count);
position += count;
if (position >= length)
length = position;