Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit d9cf710

Browse files
committed
Bug 1241522 - handle OOM in nsExpatDriver::HandleCharacterData; r=hsivonen
1 parent b6a4636 commit d9cf710

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

parser/htmlparser/nsExpatDriver.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
#include "mozilla/Logging.h"
3535

36+
using mozilla::fallible;
3637
using mozilla::LogLevel;
3738

3839
#define kExpatSeparatorChar 0xFFFF
@@ -415,7 +416,9 @@ nsExpatDriver::HandleCharacterData(const char16_t *aValue,
415416
NS_ASSERTION(mSink, "content sink not found!");
416417

417418
if (mInCData) {
418-
mCDataText.Append(aValue, aLength);
419+
if (!mCDataText.Append(aValue, aLength, fallible)) {
420+
MaybeStopParser(NS_ERROR_OUT_OF_MEMORY);
421+
}
419422
}
420423
else if (mSink) {
421424
nsresult rv = mSink->HandleCharacterData(aValue, aLength);

0 commit comments

Comments
 (0)