diff options
author | Vitaly Buka <vitalybuka@chromium.org> | 2014-11-18 17:17:31 -0800 |
---|---|---|
committer | Vitaly Buka <vitalybuka@chromium.org> | 2014-11-18 17:17:31 -0800 |
commit | 90e29cbcdc6661b7191da9b4079428847da617b6 (patch) | |
tree | 611bd991c17051ef9aa0bfa89d42ce5dedf58d5b | |
parent | 0d8b679fb2dbb3f4df9437f2a2b618e1eab1aa1b (diff) | |
download | pdfium-90e29cbcdc6661b7191da9b4079428847da617b6.tar.xz |
Fixed crash on NULL de-referencing.
BUG=433992
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/733273002
-rw-r--r-- | core/src/fpdftext/fpdf_text_int.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index 5b174f0187..42bbffa52e 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -1499,7 +1499,7 @@ void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) CPDF_ContentMarkItem& item = pMarkData->GetItem(n); CFX_ByteString tagStr = (CFX_ByteString)item.GetName(); pDict = (CPDF_Dictionary*)item.GetParam(); - CPDF_String* temp = (CPDF_String*)pDict->GetElement(FX_BSTRC("ActualText")); + CPDF_String* temp = (CPDF_String*)(pDict ? pDict->GetElement(FX_BSTRC("ActualText")) : NULL); if (temp) { actText = temp->GetUnicodeText(); } @@ -1875,30 +1875,30 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) } } } - if (bIsBidiAndMirrosInverse) {
- FX_INT32 i, j;
- i = iCharListStartAppend;
- j = m_TempCharList.GetSize() - 1;
- PAGECHAR_INFO tempCharInfo;
- FX_INT32 tempIndex = 0;
- for (; i < j; i++, j--) {
- tempCharInfo = m_TempCharList[i];
- m_TempCharList[i] = m_TempCharList[j];
- m_TempCharList[j] = tempCharInfo;
- tempIndex = m_TempCharList[i].m_Index;
- m_TempCharList[i].m_Index = m_TempCharList[j].m_Index;
- m_TempCharList[j].m_Index = tempIndex;
- }
- FX_WCHAR * pTempBuffer = m_TempTextBuf.GetBuffer();
- i = iBufStartAppend;
- j = m_TempTextBuf.GetLength() - 1;
- FX_WCHAR wTemp;
- for (; i < j; i++, j--) {
- wTemp = pTempBuffer[i];
- pTempBuffer[i] = pTempBuffer[j];
- pTempBuffer[j] = wTemp;
- }
- }
+ if (bIsBidiAndMirrosInverse) { + FX_INT32 i, j; + i = iCharListStartAppend; + j = m_TempCharList.GetSize() - 1; + PAGECHAR_INFO tempCharInfo; + FX_INT32 tempIndex = 0; + for (; i < j; i++, j--) { + tempCharInfo = m_TempCharList[i]; + m_TempCharList[i] = m_TempCharList[j]; + m_TempCharList[j] = tempCharInfo; + tempIndex = m_TempCharList[i].m_Index; + m_TempCharList[i].m_Index = m_TempCharList[j].m_Index; + m_TempCharList[j].m_Index = tempIndex; + } + FX_WCHAR * pTempBuffer = m_TempTextBuf.GetBuffer(); + i = iBufStartAppend; + j = m_TempTextBuf.GetLength() - 1; + FX_WCHAR wTemp; + for (; i < j; i++, j--) { + wTemp = pTempBuffer[i]; + pTempBuffer[i] = pTempBuffer[j]; + pTempBuffer[j] = wTemp; + } + } } FX_INT32 CPDF_TextPage::GetTextObjectWritingMode(const CPDF_TextObject* pTextObj) { |