From 50bbbaaae2842bff3beb6e3007bc661e4ddb55ed Mon Sep 17 00:00:00 2001 From: "dveditz@cruzio.com" Date: Thu, 28 Jun 2007 13:02:58 -0700 Subject: [PATCH] Bug 284219: add EnsureStringLength() helper function to nsReadableUtils.h to simplify OOM checks when growing an nsAString. r/sr=darin --- intl/unicharutil/util/nsBidiUtils.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/intl/unicharutil/util/nsBidiUtils.cpp b/intl/unicharutil/util/nsBidiUtils.cpp index 6b4b6c552d1b..3ae68bf8b1ee 100644 --- a/intl/unicharutil/util/nsBidiUtils.cpp +++ b/intl/unicharutil/util/nsBidiUtils.cpp @@ -277,6 +277,8 @@ nsresult ArabicShaping(const PRUnichar* aString, PRUint32 aLen, PRBool aInputLogical, PRBool aOutputLogical) { nsAutoString tempString(aString, aLen); + if (tempString.Length() != aLen) + return NS_ERROR_OUT_OF_MEMORY; PRUnichar *tempBuf = tempString.BeginWriting(); if (aInputLogical) { ReverseString(tempBuf, aLen);