[Libreoffice-commits] core.git: sw/source
Caolán McNamara
caolanm at redhat.com
Sat Dec 30 16:21:59 UTC 2017
sw/source/filter/ww8/ww8graf.cxx | 11 +++++++++++
1 file changed, 11 insertions(+)
New commits:
commit 9f8dd17b1e6ab5d5d07b61e0f85edea233f03d71
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Dec 30 13:57:38 2017 +0000
ofz#4837 Null-dereference READ
Change-Id: I7e4cb934aeac32fa1170beb116e4600b5eb9389a
Reviewed-on: https://gerrit.libreoffice.org/47197
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 90110354b647..34298b2cbfeb 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -559,6 +559,15 @@ public:
}
};
+namespace
+{
+ bool IsValidSel(const EditEngine& rEngine, const ESelection& rSel)
+ {
+ const auto nParaCount = rEngine.GetParagraphCount();
+ return rSel.nStartPara < nParaCount && rSel.nEndPara < nParaCount;
+ }
+}
+
// InsertAttrsAsDrawingAttrs() sets attributes between StartCp and EndCp.
// Style attributes are set as hard, paragraph and character attributes.
void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp,
@@ -733,6 +742,8 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp,
{
ESelection aSel(GetESelection(*m_pDrawEditEngine, aIter->GetStartPos()-nStartCp,
aIter->GetEndPos()-nStartCp));
+ if (!IsValidSel(*m_pDrawEditEngine, aSel))
+ continue;
OUString aString(m_pDrawEditEngine->GetText(aSel));
const sal_Int32 nOrigLen = aString.getLength();
WW8_CP nDummy(0);
More information about the Libreoffice-commits
mailing list