sw/qa/core/data/ww8/pass/ofz57592-1.doc                 |binary
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   17 +++++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 748c1400a4408ad875d72044bb635524cfeddf4d
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Apr 1 21:31:12 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Apr 18 14:41:19 2023 +0200

    ofz#57592 Null-dereference READ
    
    Change-Id: I6fc96bb0be6c5a872861987a195b0d628f574c46
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149918
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    (cherry picked from commit 484fa53f43977e390bf79831cf7096983a440cff)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150557
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/core/data/ww8/pass/ofz57592-1.doc 
b/sw/qa/core/data/ww8/pass/ofz57592-1.doc
new file mode 100644
index 000000000000..289343a1afb7
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/ofz57592-1.doc differ
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 21f67d9a9774..a87dc20f8516 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -626,18 +626,21 @@ namespace sw
         }
         while (!startedFields.empty())
         {
-            SwPosition const& 
rStart(std::get<0>(startedFields.top())->GetMarkStart());
-            std::pair<SwNodeOffset, sal_Int32> const pos(
-                    rStart.GetNodeIndex(), rStart.GetContentIndex());
-            auto it = std::lower_bound(rBreaks.begin(), rBreaks.end(), pos);
-            assert(it == rBreaks.end() || *it != pos);
-            rBreaks.insert(it, pos);
+            if (const sw::mark::IFieldmark* pMark = 
std::get<0>(startedFields.top()))
+            {
+                SwPosition const& rStart(pMark->GetMarkStart());
+                std::pair<SwNodeOffset, sal_Int32> const pos(
+                        rStart.GetNodeIndex(), rStart.GetContentIndex());
+                auto it = std::lower_bound(rBreaks.begin(), rBreaks.end(), 
pos);
+                assert(it == rBreaks.end() || *it != pos);
+                rBreaks.insert(it, pos);
+            }
             if (std::get<1>(startedFields.top()))
             {
                 std::pair<SwNodeOffset, sal_Int32> const posSep(
                     std::get<2>(startedFields.top()),
                     std::get<3>(startedFields.top()));
-                it = std::lower_bound(rBreaks.begin(), rBreaks.end(), posSep);
+                auto it = std::lower_bound(rBreaks.begin(), rBreaks.end(), 
posSep);
                 assert(it == rBreaks.end() || *it != posSep);
                 rBreaks.insert(it, posSep);
             }

Reply via email to