diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-08-29 12:22:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-08-29 15:04:39 +0200 |
commit | 384abc0615b22c586544689d5e28e92c0e74481e (patch) | |
tree | a425fd38dcfd8433b91b3819cbcd700f6a87fc5e | |
parent | 663b0a92dc845191b7a7e01856d4b5bee3e0e404 (diff) |
Related: tdf#112018 limit to min of 1 before conversion from signed int
Change-Id: I1a27f9ebfbe70891d64afa9553f37f565f2d49bf
Reviewed-on: https://gerrit.libreoffice.org/41689
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/filter/xml/xmltbli.cxx | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 698564ecb960..5ada656f30de 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -470,19 +470,13 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl( GetImport().GetTextImport()->SetCellParaStyleDefault(rValue); break; case XML_TOK_TABLE_NUM_COLS_SPANNED: - nColSpan = (sal_uInt32)rValue.toInt32(); - if( nColSpan < 1 ) - nColSpan = 1; + nColSpan = (sal_uInt32)std::max<sal_Int32>(1, rValue.toInt32()); break; case XML_TOK_TABLE_NUM_ROWS_SPANNED: - nRowSpan = (sal_uInt32)rValue.toInt32(); - if( nRowSpan < 1 ) - nRowSpan = 1; + nRowSpan = (sal_uInt32)std::max<sal_Int32>(1, rValue.toInt32()); break; case XML_TOK_TABLE_NUM_COLS_REPEATED: - nColRepeat = (sal_uInt32)rValue.toInt32(); - if( nColRepeat < 1 ) - nColRepeat = 1; + nColRepeat = (sal_uInt32)std::max<sal_Int32>(1, rValue.toInt32()); break; case XML_TOK_TABLE_FORMULA: { @@ -897,9 +891,7 @@ SwXMLTableRowContext_Impl::SwXMLTableRowContext_Impl( SwXMLImport& rImport, } else if( IsXMLToken( aLocalName, XML_NUMBER_ROWS_REPEATED ) ) { - nRowRepeat = (sal_uInt32)rValue.toInt32(); - if( nRowRepeat < 1 ) - nRowRepeat = 1; + nRowRepeat = (sal_uInt32)std::max<sal_Int32>(1, rValue.toInt32()); } else if( IsXMLToken( aLocalName, XML_DEFAULT_CELL_STYLE_NAME ) ) { |