summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-11-25 13:17:59 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2015-11-25 13:17:59 +0800
commitab777e40b58c68e4e9203a2241c059ce50d797fd (patch)
treeb8f6b2335ca0382b6ca8d5594d1ca26186bfa7bc /xfa
parent8d89e65897d8b6cf7899e7a82d9d381c3ad327cb (diff)
downloadpdfium-ab777e40b58c68e4e9203a2241c059ce50d797fd.tar.xz
Fix a crasher in rendering rich text in XFA files
Increase ref number of pStyle when it's being used. In this way, it won't be released when it's being used. BUG=pdfium:267 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1468123003 .
Diffstat (limited to 'xfa')
-rw-r--r--xfa/src/fxfa/src/app/xfa_textlayout.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/xfa/src/fxfa/src/app/xfa_textlayout.cpp b/xfa/src/fxfa/src/app/xfa_textlayout.cpp
index ffc471d506..667fc11b4c 100644
--- a/xfa/src/fxfa/src/app/xfa_textlayout.cpp
+++ b/xfa/src/fxfa/src/app/xfa_textlayout.cpp
@@ -1826,10 +1826,13 @@ void CXFA_TextLayout::AppendTextLine(FX_DWORD dwStatus,
m_pLoader->m_lineHeights.Add(fHeight);
}
}
+ if (pStyle) {
+ pStyle->AddRef();
+ }
m_pBreak->ClearBreakPieces();
if (dwStatus == FX_RTFBREAK_ParagraphBreak) {
m_pBreak->Reset();
- if (pStyle == NULL && bEndBreak) {
+ if (!pStyle && bEndBreak) {
CXFA_Para para = m_pTextProvider->GetParaNode();
if (para.IsExistInXML()) {
FX_FLOAT fStartPos = para.GetMarginLeft();
@@ -1846,7 +1849,7 @@ void CXFA_TextLayout::AppendTextLine(FX_DWORD dwStatus,
}
}
}
- if (pStyle != NULL) {
+ if (pStyle) {
FX_FLOAT fStart = 0;
const FDE_CSSRECT* pRect = pStyle->GetBoundaryStyles()->GetMarginWidth();
if (pRect) {
@@ -1858,6 +1861,7 @@ void CXFA_TextLayout::AppendTextLine(FX_DWORD dwStatus,
fStart -= fTextIndent;
}
m_pBreak->SetLinePos(fStart);
+ pStyle->Release();
}
m_iLines++;
}