diff options
Diffstat (limited to 'dom/base/nsContentUtils.cpp')
-rw-r--r-- | dom/base/nsContentUtils.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 29d28f8ce..321a61f18 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -4128,9 +4128,15 @@ nsContentUtils::GetSubdocumentWithOuterWindowId(nsIDocument *aDocument, /* static */ nsresult nsContentUtils::ConvertStringFromEncoding(const nsACString& aEncoding, - const nsACString& aInput, + const char* aInput, + uint32_t aInputLen, nsAString& aOutput) { + CheckedInt32 len = aInputLen; + if (!len.isValid()) { + return NS_ERROR_OUT_OF_MEMORY; + } + nsAutoCString encoding; if (aEncoding.IsEmpty()) { encoding.AssignLiteral("UTF-8"); @@ -4142,7 +4148,7 @@ nsContentUtils::ConvertStringFromEncoding(const nsACString& aEncoding, nsAutoPtr<TextDecoder> decoder(new TextDecoder()); decoder->InitWithEncoding(encoding, false); - decoder->Decode(aInput.BeginReading(), aInput.Length(), false, + decoder->Decode(aInput, len.value(), false,, aOutput, rv); return rv.StealNSResult(); } |