diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-30 13:57:38 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-12-30 17:21:35 +0100 |
commit | 9f8dd17b1e6ab5d5d07b61e0f85edea233f03d71 (patch) | |
tree | da5b79ea421f6a52e6b0250e7b4a2eae7821c345 /sw/source | |
parent | 13763bda39bb267382c4824eb29e9575d6a4b811 (diff) |
ofz#4837 Null-dereference READ
Change-Id: I7e4cb934aeac32fa1170beb116e4600b5eb9389a
Reviewed-on: https://gerrit.libreoffice.org/47197
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
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); |