sw/source/core/access/AccessibilityCheck.cxx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
New commits: commit 1190623696c5664b13e874e047a96a50ce5bba30 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Dec 22 10:38:52 2023 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Dec 22 13:25:16 2023 +0100 sw: fix another null deref in a11y check similar to author Caolán McNamara <caolan.mcnam...@collabora.com> 2023-12-21 16:47:18 +0000 committer Caolán McNamara <caolan.mcnam...@collabora.com> 2023-12-21 21:15:03 +0100 commit ba712e9a35179c480cdc6f9d600d79040a273d53 (patch) tree 88e237265eb6ce884d2807b4c178a761d4c73956 parent 8cd01e5278b2be25a1186139e431591a85a5080f (diff) crashreporting: apparent null deref in a11y check Change-Id: I3fb6a916fcbcce4b599a925dcc7d39a12e60a972 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161149 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index 9ab27ba788fc..f1ec39b05949 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -132,7 +132,7 @@ class NoTextNodeAltTextCheck : public NodeCheck sfx::AccessibilityIssueID::LINKED_GRAPHIC); pIssue->setDoc(pNoTextNode->GetDoc()); pIssue->setIssueObject(IssueObject::LINKED); - pIssue->setObjectID(pNoTextNode->GetFlyFormat()->GetName()); + pIssue->setObjectID(pFrameFormat->GetName()); pIssue->setNode(pNoTextNode); pIssue->setAdditionalInfo({ aSystemPath }); } @@ -161,7 +161,7 @@ class NoTextNodeAltTextCheck : public NodeCheck sfx::AccessibilityIssueID::NO_ALT_GRAPHIC); pIssue->setDoc(pNoTextNode->GetDoc()); pIssue->setIssueObject(IssueObject::GRAPHIC); - pIssue->setObjectID(pNoTextNode->GetFlyFormat()->GetName()); + pIssue->setObjectID(pFrameFormat->GetName()); pIssue->setNode(pNoTextNode); } } @@ -1226,14 +1226,20 @@ public: return; // If a node is in fly and if it is not anchored as char, throw warning. - const SwNode* startFly = pCurrent->FindFlyStartNode(); - if (startFly - && startFly->GetFlyFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR) + const SwNode* pStartFly = pCurrent->FindFlyStartNode(); + if (!pStartFly) + return; + + const SwFrameFormat* pFormat = pStartFly->GetFlyFormat(); + if (!pFormat) + return; + + if (pFormat->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR) { SwNodeIndex aCurrentIdx(*pCurrent); - SwNodeIndex aIdx(*startFly); + SwNodeIndex aIdx(*pStartFly); SwNode* pFirstTextNode = &aIdx.GetNode(); - SwNodeOffset nEnd = startFly->EndOfSectionIndex(); + SwNodeOffset nEnd = pStartFly->EndOfSectionIndex(); while (aIdx < nEnd) { if (pFirstTextNode->IsContentNode() && pFirstTextNode->IsTextNode()) @@ -1242,7 +1248,7 @@ public: { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_FLOATING_TEXT)); pIssue->setIssueObject(IssueObject::TEXTFRAME); - pIssue->setObjectID(startFly->GetFlyFormat()->GetName()); + pIssue->setObjectID(pFormat->GetName()); pIssue->setDoc(pCurrent->GetDoc()); pIssue->setNode(pCurrent); }