sw/source/core/text/inftxt.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 50602fed86b2b972d49d6c6366b2a3eb406e4ed4
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sun Oct 10 21:29:29 2021 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue Oct 12 11:57:17 2021 +0200

    Try to fix Ubsan TB
    
    /sw/source/core/text/inftxt.cxx:651:37: runtime error: downcast of address 
0x6060006542c0 which does not point to an object of type ´const SwTextPortion´
    0x6060006542c0: note: object is of type ´SwBookmarkPortion´
    3f 07 00 26  d0 ca 08 e3 2b 2b 00 00  2d 00 00 00 00 00 00 00  49 01 00 00 
00 00 00 00  60 42 65 00
                 ^~~~~~~~~~~~~~~~~~~~~~~
                 vptr for ´SwBookmarkPortion´
    0x2b2bda76d6b7 in SwTextPaintInfo::DrawText_(rtl::OUString const&, 
SwLinePortion const&, o3tl::strong_int<int, Tag_TextFrameIndex>,
    o3tl::strong_int<int, Tag_TextFrameIndex>, bool, bool, bool, bool) 
/sw/source/core/text/inftxt.cxx:651:37
    
    Taking a look at some other locations in the same file, it seems we need to 
test "rPor.InTextGrp()" to consider rPor as a SwTextPortion
    
    Change-Id: I1739182a65f6738dad8623ec22950d797c59a6c7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123356
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index b22ed6efdbcb..d85df6397551 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -648,7 +648,7 @@ void SwTextPaintInfo::DrawText_( const OUString &rText, 
const SwLinePortion &rPo
 
     // Draw text next to the left border
     Point aFontPos(m_aPos);
-    if( m_pFnt->GetLeftBorder() && !static_cast<const 
SwTextPortion&>(rPor).GetJoinBorderWithPrev() )
+    if( m_pFnt->GetLeftBorder() && rPor.InTextGrp() && !static_cast<const 
SwTextPortion&>(rPor).GetJoinBorderWithPrev() )
     {
         const sal_uInt16 nLeftBorderSpace = m_pFnt->GetLeftBorderSpace();
         if ( GetTextFrame()->IsRightToLeft() )

Reply via email to