Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Unified Diff: core/src/fpdftext/fpdf_text_int.cpp

Issue 733273002: Fixed crash on NULL de-referencing. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: 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 5b174f0187bf523fe77675d86854f0856b4e25ae..42bbffa52ee8ff6bebe71f7ed7577ec266a579b9 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)
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698