From: DionYe Date: Fri, 15 Jan 2016 03:32:01 +0000 (+0800) Subject: Add check for out of memory X-Git-Tag: accepted/tizen/base/20180629.140029~5828^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1511bcbdf3aebf552b4bb550dceed0eb9a27f160;p=platform%2Fupstream%2Fcoreclr.git Add check for out of memory --- diff --git a/src/mscorlib/src/System/StubHelpers.cs b/src/mscorlib/src/System/StubHelpers.cs index 699662b..a78a158 100644 --- a/src/mscorlib/src/System/StubHelpers.cs +++ b/src/mscorlib/src/System/StubHelpers.cs @@ -173,6 +173,11 @@ namespace System.StubHelpers { // If not provided, allocate the buffer using SysAllocStringByteLen so // that odd-sized strings will be handled as well. ptrToFirstChar = (byte *)Win32Native.SysAllocStringByteLen(null, lengthInBytes).ToPointer(); + + if (ptrToFirstChar == null) + { + throw new OutOfMemoryException(); + } } // copy characters from the managed string