• Stephan Bergmann's avatar
    SwGluePortion::GetPrtGlue() can legitimately be larger than 'short` · 60c12198
    Stephan Bergmann yazdı
    At least during JunitTest_sw_unoapi_4
    sw.SwXTextTable::com::sun::star::text::TextTable::TableColumnSeparators, some
    SwFormatFrameSize is created with a width of USHRT_MAX ("Set USHRT_MAX as the
    Table's default SSize") in SwDoc::InsertTable
    (sw/source/core/docnode/ndtbl.cxx).  In SwTabFrame::Format
    (sw/source/core/layout/tabfrm.cxx) that leads to nWishedTableWidth with a value
    near USHRT_MAX and substantially larger than nMax, causing nLeftSpacing to be a
    large negative value in the text::HoriOrientation::CENTER case.  That in turn
    causes SwTextAdjuster::CalcRightMargin (sw/source/core/text/itradj.cxx) to
    set
    
        pRight->PrtWidth( sal_uInt16( nRealWidth - nPrtWidth ) );
    
    with a value of 32768 (where pRight is a SwGluePortion).  And a later call to
    that SwGluePortion's GetPrtGlue would try to convert that 32768 to 'short',
    getting flagged by Clang's -fsanitize=implicit-signed-integer-truncation.
    
    In addition to changing GetPrtGlue (and MoveGlue) to use 'long' instead of
    'short', drop some unncessary narrowing casts from client code.
    
    Change-Id: I6a0d763acfad1fc3b550ec6107adf9f5429dd005
    Reviewed-on: https://gerrit.libreoffice.org/68253
    Tested-by: Jenkins
    Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
    60c12198
Adı
Son kayıt (commit)
Son güncelleme
..
core Loading commit data...
filter Loading commit data...
ui Loading commit data...
uibase Loading commit data...