From bf4aa2cc93a67826247e887b2ba26a1b965eb616 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 19 May 2015 14:56:52 -0700 Subject: Revert "Remove FX_Alloc() null checks now that it can't return NULL." This reverts commit eb6527763171cdb4b0fbfea5a20d691f4d67b660. Reason for revert: broke javascript tests. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1145843005 --- core/src/fpdftext/fpdf_text_int.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'core/src/fpdftext/fpdf_text_int.cpp') diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index 69d0bc574f..882b22ceec 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -1164,6 +1164,9 @@ void CPDF_TextPage::AddCharInfoByLRDirection(CFX_WideString& str, int i) FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); if (nCount >= 1) { pDst = FX_Alloc(FX_WCHAR, nCount); + if (!pDst) { + return; + } FX_Unicode_GetNormalization(wChar, pDst); for (int nIndex = 0; nIndex < nCount; nIndex++) { PAGECHAR_INFO Info2 = Info; @@ -1196,6 +1199,9 @@ void CPDF_TextPage::AddCharInfoByRLDirection(CFX_WideString& str, int i) FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); if (nCount >= 1) { pDst = FX_Alloc(FX_WCHAR, nCount); + if (!pDst) { + return; + } FX_Unicode_GetNormalization(wChar, pDst); for (int nIndex = 0; nIndex < nCount; nIndex++) { PAGECHAR_INFO Info2 = Info; -- cgit v1.2.3