diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-08-16 18:06:22 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-08-16 21:55:03 +0200 |
commit | 085933f202cf973782a20a46a60087ff943ad6b9 (patch) | |
tree | c5602cde42aa99be15c30d8fb87101db972e8c1e /editeng | |
parent | 0bafa88ce38bc9f6735d8118e544aa9232cc840c (diff) |
SvxNumberFormat::nFirstLineOffset should have a larger type
...similar to 0d227c96e11d7d03829144183bc66d229e059a4b
"SvxNumberFormat::nAbsLSpace should have a larger type", this time due to:
> Testing file:///home/sbergman/lo/core/sd/qa/unit/data/ppt/pass/hang-10.ppt:
[...]
> filter/source/msfilter/svdfppt.cxx:3793:39: runtime error: implicit conversion from type 'sal_Int32' (aka 'int') of value -142240 (32-bit, signed) to type 'short' changed the value to -11168 (16-bit, signed)
> #0 in PPTNumberFormatCreator::ImplGetNumberFormat(SdrPowerPointImport const&, SvxNumberFormat&) at filter/source/msfilter/svdfppt.cxx:3793:39 (instdir/program/libmsfilterlo.so +0x79930d)
> #1 in PPTNumberFormatCreator::GetNumberFormat(SdrPowerPointImport const&, SvxNumberFormat&, unsigned int, PPTParaLevel const&, PPTCharLevel const&, TSS_Type) at filter/source/msfilter/svdfppt.cxx:3674:5 (instdir/program/libmsfilterlo.so +0x797bad)
> #2 in PPTStyleSheet::PPTStyleSheet(DffRecordHeader const&, SvStream&, SdrPowerPointImport&, PPTTextParagraphStyleAtomInterpreter const&, PPTTextSpecInfo const&) at filter/source/msfilter/svdfppt.cxx:4395:13 (instdir/program/libmsfilterlo.so +0x7ac27d)
> #3 in SdrPowerPointImport::SdrPowerPointImport(PowerPointImportParam&, rtl::OUString const&) at filter/source/msfilter/svdfppt.cxx:1618:59 (instdir/program/libmsfilterlo.so +0x74759f)
> #4 in ImplSdPPTImport::ImplSdPPTImport(SdDrawDocument*, SotStorage&, SfxMedium&, PowerPointImportParam&) at sd/source/filter/ppt/pptin.cxx:175:7 (instdir/program/libsdfiltlo.so +0x5f2be8)
> #5 in SdPPTImport::SdPPTImport(SdDrawDocument*, SvStream&, SotStorage&, SfxMedium&) at sd/source/filter/ppt/pptin.cxx:162:23 (instdir/program/libsdfiltlo.so +0x5ce2bb)
> #6 in ImportPPT at sd/source/filter/ppt/pptin.cxx:2760:47 (instdir/program/libsdfiltlo.so +0x617c79)
> #7 in SdPPTFilter::Import() at sd/source/filter/sdpptwrp.cxx:106:32 (instdir/program/libsdlo.so +0x2878233)
> #8 in sd::DrawDocShell::ConvertFrom(SfxMedium&) at sd/source/ui/docshell/docshel4.cxx:474:46 (instdir/program/libsdlo.so +0x2e163dc)
> #9 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:786:23 (instdir/program/libsfxlo.so +0x2c8c492)
> #10 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:75:31 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x19771)
> #11 in test::FiltersTest::recursiveScan(test::filterStatus, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:130:20 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x5724c)
> #12 in test::FiltersTest::testDir(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:155:5 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x57ec9)
> #13 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x19d6d)
Change-Id: Icd83120e99ac8e7181d75e2cf9d13f49064e65e1
Reviewed-on: https://gerrit.libreoffice.org/59212
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editdbg.cxx | 2 | ||||
-rw-r--r-- | editeng/source/items/numitem.cxx | 14 | ||||
-rw-r--r-- | editeng/source/uno/unonrule.cxx | 4 |
3 files changed, 12 insertions, 8 deletions
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 51bf4a63498f..28e9b4d53a6f 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -88,7 +88,7 @@ OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem) if ( pFmt ) { aDebStr.append('('); - aDebStr.append(static_cast<sal_Int32>(pFmt->GetFirstLineOffset())); + aDebStr.append(pFmt->GetFirstLineOffset()); aDebStr.append(','); aDebStr.append(pFmt->GetAbsLSpace()); aDebStr.append(','); diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index f85c4aec9855..0e8c012a5df9 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -197,8 +197,10 @@ SvxNumberFormat::SvxNumberFormat( SvStream &rStream ) rStream.ReadUInt16( nStart ); rStream.ReadUInt16( nTmp16 ); cBullet = static_cast<sal_Unicode>(nTmp16); - rStream.ReadInt16( nFirstLineOffset ); - sal_Int16 temp; + sal_Int16 temp = 0; + rStream.ReadInt16( temp ); + nFirstLineOffset = temp; + temp = 0; rStream.ReadInt16( temp ); nAbsLSpace = temp; rStream.SeekRel(2); //skip old now unused nLSpace; @@ -261,7 +263,9 @@ void SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverte rStream.WriteUInt16( nStart ); rStream.WriteUInt16( cBullet ); - rStream.WriteInt16( nFirstLineOffset ); + rStream.WriteInt16( + sal_Int16(o3tl::clamp<sal_Int32>(nFirstLineOffset, SAL_MIN_INT16, SAL_MAX_INT16)) ); + //TODO: better way to handle out-of-bounds value? rStream.WriteInt16( sal_Int16(o3tl::clamp<sal_Int32>(nAbsLSpace, SAL_MIN_INT16, SAL_MAX_INT16)) ); //TODO: better way to handle out-of-bounds value? @@ -452,11 +456,11 @@ sal_Int32 SvxNumberFormat::GetAbsLSpace() const ? nAbsLSpace : static_cast<sal_Int32>( GetFirstLineIndent() + GetIndentAt() ); } -short SvxNumberFormat::GetFirstLineOffset() const +sal_Int32 SvxNumberFormat::GetFirstLineOffset() const { return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nFirstLineOffset - : static_cast<short>( GetFirstLineIndent() ); + : static_cast<sal_Int32>( GetFirstLineIndent() ); } short SvxNumberFormat::GetCharTextDistance() const { diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx index 30c7deab2e94..74ac1596146a 100644 --- a/editeng/source/uno/unonrule.cxx +++ b/editeng/source/uno/unonrule.cxx @@ -248,7 +248,7 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex(sal aVal <<= rFmt.GetAbsLSpace(); pArray[nIdx++] = beans::PropertyValue(UNO_NAME_NRULE_LEFT_MARGIN, -1, aVal, beans::PropertyState_DIRECT_VALUE); - aVal <<= static_cast<sal_Int32>(rFmt.GetFirstLineOffset()); + aVal <<= rFmt.GetFirstLineOffset(); pArray[nIdx++] = beans::PropertyValue(UNO_NAME_NRULE_FIRST_LINE_OFFSET, -1, aVal, beans::PropertyState_DIRECT_VALUE); pArray[nIdx++] = beans::PropertyValue("SymbolTextDistance", -1, aVal, beans::PropertyState_DIRECT_VALUE); @@ -411,7 +411,7 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex(const Sequence<beans::Propert sal_Int32 nMargin = 0; if( aVal >>= nMargin ) { - aFmt.SetFirstLineOffset(static_cast<sal_uInt16>(nMargin)); + aFmt.SetFirstLineOffset(nMargin); continue; } } |