[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/filter/itiff/itiff.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit e8f7138292b1e5eabac7969e8d6fe64d3dda3e51 Author: Julien Nabet AuthorDate: Sun Apr 17 20:03:26 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Apr 18 15:04:02 2022 +0200 tdf#142151: Red cast rendered in 16 bit TIFF image I found this fix by testing "pure" red/green/blue files (see attachments in the bugtracker) where red 16 bits file was ok but not green and blue 16 bits ones. Change-Id: Ic700a0fa17c3056d1d4f1d1a7f16a799ff4c7378 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133108 (cherry picked from commit 49ee1c889665c3539fa9a1c99a865a42fc08ee97) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133051 Reviewed-by: Mike Kaganski Tested-by: Jenkins (cherry picked from commit 1af0bf010b839b7b34e856dfc5a7385db45c9aa7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133053 Reviewed-by: Xisco Fauli diff --git a/vcl/source/filter/itiff/itiff.cxx b/vcl/source/filter/itiff/itiff.cxx index 906826ae9e55..03326a36132e 100644 --- a/vcl/source/filter/itiff/itiff.cxx +++ b/vcl/source/filter/itiff/itiff.cxx @@ -912,8 +912,8 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY) if ( nPlanes < 3 ) { nRed = GetBits( getMapData(0), ( nx * nSamplesPerPixel + 0 ) * nBitsPerSample, nBitsPerSample ); -nGreen = GetBits( getMapData(1), ( nx * nSamplesPerPixel + 1 ) * nBitsPerSample, nBitsPerSample ); -nBlue = GetBits( getMapData(2), ( nx * nSamplesPerPixel + 2 ) * nBitsPerSample, nBitsPerSample ); +nGreen = GetBits( getMapData(0), ( nx * nSamplesPerPixel + 1 ) * nBitsPerSample, nBitsPerSample ); +nBlue = GetBits( getMapData(0), ( nx * nSamplesPerPixel + 2 ) * nBitsPerSample, nBitsPerSample ); } else {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/outdev/text.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 6204b213d478d99ff556b2b270af3151da1ac357 Author: Caolán McNamara AuthorDate: Tue Apr 12 08:45:23 2022 +0100 Commit: Michael Stahl CommitDate: Tue Apr 12 11:57:24 2022 +0200 ofz: Use-of-uninitialized-value Change-Id: I87cfad2da9b90bc4487dc4deb2fda5bb31a6b763 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132857 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 9de93b342c53..0c73a4d347fd 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1678,7 +1678,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta tools::Long nMnemonicX = 0; tools::Long nMnemonicY = 0; DeviceCoordinate nMnemonicWidth = 0; -if ( nMnemonicPos != -1 ) +if (nMnemonicPos != -1 && nMnemonicPos < aStr.getLength()) { std::unique_ptr const pCaretXArray(new tools::Long[2 * aStr.getLength()]); /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray.get(), 0, aStr.getLength() );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/helper/strhelper.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 9d5703aa0b7d11db3568a2e0aaa462fe2dd98867 Author: Caolán McNamara AuthorDate: Thu Mar 24 09:33:44 2022 + Commit: Xisco Fauli CommitDate: Mon Mar 28 11:58:26 2022 +0200 forcepoint#85 Conditional jump or move depends on uninitialised value ==398461==by 0xCDC7960: (anonymous namespace)::CopyUntil(char16_t*&, char16_t const*&, char16_t, bool) (strhelper.cxx:88) ==398461==by 0xCDC839F: psp::WhitespaceToSpace(rtl::OUString const&, bool) (strhelper.cxx:294) ==398461==by 0xCB54980: vcl::PDFWriterImpl::setOutlineItemText(int, rtl::OUString const&) (pdfwriter_impl.cxx:9875) ==398461==by 0xCB547FF: vcl::PDFWriterImpl::createOutlineItem(int, rtl::OUString const&, int) (pdfwriter_impl.cxx:9851) ==398461==by 0xCAF39B0: vcl::PDFWriter::CreateOutlineItem(int, rtl::OUString const&, int) (pdfwriter.cxx:383) ==398461==by 0xCABD7C8: vcl::GlobalSyncData::PlayGlobalActions(vcl::PDFWriter&) (pdfextoutdevdata.cxx:250) ==398461==by 0xCAC0628: vcl::PDFExtOutDevData::PlayGlobalActions(vcl::PDFWriter&) (pdfextoutdevdata.cxx:616) ==398461==by 0x3D06EA0F: PDFExport::Export(rtl::OUString const&, com::sun::star::uno::Sequence const&) (pdfexport.cxx:1004) Change-Id: I6bc086997851ee06531a4a9ae263e2b26edfba84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132036 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx index 96e10b4865e8..782c9ce123e1 100644 --- a/vcl/source/helper/strhelper.cxx +++ b/vcl/source/helper/strhelper.cxx @@ -83,7 +83,8 @@ void CopyUntil( sal_Unicode*& pTo, const sal_Unicode*& pFrom, sal_Unicode cUntil *pTo = *pFrom; pTo++; } -pFrom++; +if( *pFrom ) +pFrom++; } while( *pFrom && *pFrom != cUntil ); // copy the terminating character unless zero or protector if( ! isProtect( *pFrom ) || bIncludeUntil )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/filter/png/pngwrite.cxx | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) New commits: commit 61c5101a95308fe20e684fa72457c867bd115216 Author: Julien Nabet AuthorDate: Sat Mar 5 12:37:40 2022 +0100 Commit: Xisco Fauli CommitDate: Thu Mar 10 10:33:46 2022 +0100 tdf#136632: Use 'Save transparency' when exporting selected objects for PNG To avoid some regression, consider that transparency should be enabled by default. So only remove transparency if it's required explicitely. + change QA test since "Translucent" property isn't a bool but a sal_Int32 In officecfg/registry/schema/org/openoffice/Office/Common.xcs: Change-Id: I9bfb6aae8e2e8a31dee82f73a9165989129f222a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131057 Tested-by: Jenkins Reviewed-by: Julien Nabet Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131061 Reviewed-by: Xisco Fauli (cherry picked from commit 43356e4d9fe022f24265747cb4b0ae2fc3cd3236) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131133 diff --git a/vcl/source/filter/png/pngwrite.cxx b/vcl/source/filter/png/pngwrite.cxx index 0554a314e83c..e89cbba69a85 100644 --- a/vcl/source/filter/png/pngwrite.cxx +++ b/vcl/source/filter/png/pngwrite.cxx @@ -123,6 +123,7 @@ PNGWriterImpl::PNGWriterImpl(const BitmapEx& rBitmapEx, Bitmap aBmp(aBitmapEx.GetBitmap()); mnMaxChunkSize = std::numeric_limits::max(); +bool bTranslucent = true; if (pFilterData) { @@ -132,6 +133,13 @@ PNGWriterImpl::PNGWriterImpl(const BitmapEx& rBitmapEx, rPropVal.Value >>= mnCompLevel; else if (rPropVal.Name == "Interlaced") rPropVal.Value >>= mnInterlaced; +else if (rPropVal.Name == "Translucent") +{ +tools::Long nTmp = 0; +rPropVal.Value >>= nTmp; +if (!nTmp) +bTranslucent = false; +} else if (rPropVal.Name == "MaxChunkSize") { sal_Int32 nVal = 0; @@ -142,7 +150,7 @@ PNGWriterImpl::PNGWriterImpl(const BitmapEx& rBitmapEx, } mnBitsPerPixel = sal_uInt8(vcl::pixelFormatBitCount(aBmp.getPixelFormat())); -if (aBitmapEx.IsAlpha()) +if (aBitmapEx.IsAlpha() && bTranslucent) { if (mnBitsPerPixel <= 8) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 316c50766c9ad4021a3b0732b3fbb03c4b880c64 Author: Caolán McNamara AuthorDate: Sun Mar 6 17:58:29 2022 + Commit: Michael Stahl CommitDate: Mon Mar 7 12:16:57 2022 +0100 ofz#45255 handle short O_hhea table Change-Id: I649dfdb3eff868441125fbf62ff3c7d0d18d8d19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131016 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 1734463ae1a8..706ef5c8b9df 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1751,7 +1751,7 @@ SFErrCodes CreateTTFromTTGlyphs(AbstractTrueTypeFont *ttf, /** hhea **/ p = ttf->table(O_hhea, nTableSize); -if (p) +if (p && nTableSize >= HHEA_caretSlopeRun_offset + 2) hhea = TrueTypeTableNew_hhea(GetInt16(p, HHEA_ascender_offset), GetInt16(p, HHEA_descender_offset), GetInt16(p, HHEA_lineGap_offset), GetInt16(p, HHEA_caretSlopeRise_offset), GetInt16(p, HHEA_caretSlopeRun_offset)); else hhea = TrueTypeTableNew_hhea(0, 0, 0, 0, 0);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/outdev/hatch.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit bee0950a4c5bd996a8df0185b03c0f98e7a3de9c Author: Caolán McNamara AuthorDate: Sun Mar 6 15:49:28 2022 + Commit: Michael Stahl CommitDate: Mon Mar 7 12:16:05 2022 +0100 ofz: Too many hatch points Change-Id: I08cb9d09a9bb48ab31763f50bc2fa23cf723330f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131014 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx index 8b62fcf10375..d261765d1c91 100644 --- a/vcl/source/outdev/hatch.cxx +++ b/vcl/source/outdev/hatch.cxx @@ -374,7 +374,14 @@ void OutputDevice::DrawHatchLine( const tools::Line& rLine, const tools::PolyPol nAdd = 1; if( nAdd ) +{ +if (nPCounter == HATCH_MAXPOINTS) +{ +SAL_WARN("vcl.gdi", "too many hatch points"); +return; +} pPtBuffer[ nPCounter++ ] = Point( FRound( fX ), FRound( fY ) ); +} } aCurSegment.SetStart( aCurSegment.GetEnd() );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) New commits: commit c3b0367c9aa452c3b8a179c992df948495cf067d Author: Caolán McNamara AuthorDate: Sat Mar 5 10:03:43 2022 + Commit: Michael Stahl CommitDate: Mon Mar 7 12:14:20 2022 +0100 ofz: record less than 10 bytes is invalid Change-Id: Ie6b88efbc12b4c7fddb7459e50cba28fcbcf35fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131011 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 98b758064943..1734463ae1a8 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -353,11 +353,18 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI const sal_uInt8* ptr = table + nGlyphOffset; const sal_uInt32 nMaxGlyphSize = nTableSize - nGlyphOffset; +constexpr sal_uInt32 nContourOffset = 10; +if (nMaxGlyphSize < nContourOffset) +return 0; const sal_Int16 numberOfContours = GetInt16(ptr, GLYF_numberOfContours_offset); if( numberOfContours <= 0 ) /*- glyph is not simple */ return 0; +const sal_Int32 nMaxContours = (nMaxGlyphSize - nContourOffset)/2; +if (numberOfContours > nMaxContours) +return 0; + if (metrics) {/*- GetCompoundTTOutline() calls this function with NULL metrics -*/ metrics->xMin = GetInt16(ptr, GLYF_xMin_offset); metrics->yMin = GetInt16(ptr, GLYF_yMin_offset); @@ -368,22 +375,19 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI /* determine the last point and be extra safe about it. But probably this code is not needed */ sal_uInt16 lastPoint=0; -const sal_Int32 nMaxContours = (nMaxGlyphSize - 10)/2; -if (numberOfContours > nMaxContours) -return 0; for (i=0; i lastPoint) lastPoint = t; } -sal_uInt32 nInstLenOffset = 10 + numberOfContours * 2; +sal_uInt32 nInstLenOffset = nContourOffset + numberOfContours * 2; if (nInstLenOffset + 2 > nMaxGlyphSize) return 0; sal_uInt16 instLen = GetUInt16(ptr, nInstLenOffset); -sal_uInt32 nOffset = 10 + 2 * numberOfContours + 2 + instLen; +sal_uInt32 nOffset = nContourOffset + 2 * numberOfContours + 2 + instLen; if (nOffset > nMaxGlyphSize) return 0; const sal_uInt8* p = ptr + nOffset;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/gdi/svmconverter.cxx | 20 1 file changed, 20 insertions(+) New commits: commit 19add15932e579c931480eed42eeea52d0551897 Author: Caolán McNamara AuthorDate: Fri Mar 4 10:38:50 2022 + Commit: Michael Stahl CommitDate: Mon Mar 7 12:05:52 2022 +0100 clamp and add some logging like SvmReader LIBREOFFICE-OWMTGGWJ Change-Id: I8f744e1ab2684a0f0995abcc3e753a684a3b970a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130982 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx index 75f9482b1208..ea129201f244 100644 --- a/vcl/source/gdi/svmconverter.cxx +++ b/vcl/source/gdi/svmconverter.cxx @@ -246,6 +246,23 @@ namespace nFollowingActionCount = remainingActions; return std::min(remainingActions, nFollowingActionCount); } + +void ClampRange(const OUString& rStr, sal_Int32& rIndex, sal_Int32& rLength) +{ +const sal_Int32 nStrLength = rStr.getLength(); + +if (rIndex < 0 || rIndex > nStrLength) +{ +SAL_WARN("vcl.gdi", "inconsistent offset"); +rIndex = nStrLength; +} + +if (rLength < 0 || rLength > nStrLength - rIndex) +{ +SAL_WARN("vcl.gdi", "inconsistent len"); +rLength = nStrLength - rIndex; +} +} } #define LF_FACESIZE 32 @@ -689,6 +706,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) OUString aStr(OStringToOUString(aByteStr, eActualCharSet)); if ( nUnicodeCommentActionNumber == i ) ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr ); +ClampRange(aStr, nIndex, nLen); rMtf.AddAction( new MetaTextAction( aPt, aStr, nIndex, nLen ) ); } @@ -778,6 +796,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } if ( nUnicodeCommentActionNumber == i ) ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr ); +ClampRange(aStr, nIndex, nLen); rMtf.AddAction( new MetaTextArrayAction( aPt, aStr, pDXAry.get(), nIndex, nLen ) ); } @@ -804,6 +823,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) OUString aStr(OStringToOUString(aByteStr, eActualCharSet)); if ( nUnicodeCommentActionNumber == i ) ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr ); +ClampRange(aStr, nIndex, nLen); rMtf.AddAction( new MetaStretchTextAction( aPt, nWidth, aStr, nIndex, nLen ) ); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx |7 ++- vcl/source/fontsubset/ttcr.cxx |6 +- 2 files changed, 11 insertions(+), 2 deletions(-) New commits: commit 8906788e25296f3875682bad374e6845f4bb20e2 Author: Caolán McNamara AuthorDate: Sat Feb 26 21:40:20 2022 + Commit: Caolán McNamara CommitDate: Fri Mar 4 12:47:49 2022 +0100 ofz#45073 don't dereference null pointer on bogus font Change-Id: I28616696833b87c300d2ee7061a15921042934b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130613 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130936 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 6c515dabdee7..98b758064943 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2245,8 +2245,13 @@ void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info) GlyphData *GetTTRawGlyphData(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID) { +sal_uInt32 hmtxlength; +const sal_uInt8* hmtx = ttf->table(O_hmtx, hmtxlength); + +if (!hmtxlength) +return nullptr; + sal_uInt32 length; -const sal_uInt8* hmtx = ttf->table(O_hmtx, length); const sal_uInt8* glyf = ttf->table(O_glyf, length); int n; diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index 86dc02206e92..40729ffd101d 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -1250,7 +1250,11 @@ static void ProcessTables(TrueTypeCreator *tt) glyf = FindTable(tt, T_glyf); glyphlist = static_cast(glyf->data); nGlyphs = listCount(glyphlist); -assert(nGlyphs != 0); +if (!nGlyphs) +{ +SAL_WARN("vcl.fonts", "no glyphs found in ProcessTables"); +return; +} gid = static_cast(scalloc(nGlyphs, sizeof(sal_uInt32))); RemoveTable(tt, T_loca);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx | 65 +++--- 1 file changed, 61 insertions(+), 4 deletions(-) New commits: commit ca3eb585224d13df3d27ff0db337e9d555a386ef Author: Caolán McNamara AuthorDate: Thu Mar 3 10:45:12 2022 + Commit: Michael Stahl CommitDate: Fri Mar 4 11:42:09 2022 +0100 ofz#45165 verify table offsets Change-Id: I99649a03da28d3b896bed72999b50803ce0a4761 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130858 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index a0416a01621c..6c515dabdee7 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -511,8 +511,8 @@ static int GetCompoundTTOutline(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, C { sal_uInt16 flags, index; sal_Int16 e, f; -sal_uInt32 nSize; -const sal_uInt8* table = ttf->table(O_glyf, nSize); +sal_uInt32 nTableSize; +const sal_uInt8* table = ttf->table(O_glyf, nTableSize); std::vector myPoints; ControlPoint *nextComponent, *pa; int i, np; @@ -523,7 +523,16 @@ static int GetCompoundTTOutline(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, C if (glyphID >= ttf->glyphCount()) return 0; -const sal_uInt8* ptr = table + ttf->glyphOffset(glyphID); +sal_uInt32 nGlyphOffset = ttf->glyphOffset(glyphID); +if (nGlyphOffset > nTableSize) +return 0; + +const sal_uInt8* ptr = table + nGlyphOffset; +sal_uInt32 nAvailableBytes = nTableSize - nGlyphOffset; + +if (GLYF_numberOfContours_offset + 2 > nAvailableBytes) +return 0; + if (GetInt16(ptr, GLYF_numberOfContours_offset) != -1) /* number of contours - glyph is not compound */ return 0; @@ -535,13 +544,27 @@ static int GetCompoundTTOutline(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, C GetMetrics(ttf, glyphID, metrics); } +if (nAvailableBytes < 10) +{ +SAL_WARN("vcl.fonts", "short read"); +return 0; +} + ptr += 10; +nAvailableBytes -= 10; do { + +if (nAvailableBytes < 4) +{ +SAL_WARN("vcl.fonts", "short read"); +return 0; +} flags = GetUInt16(ptr, 0); /* printf("flags: 0x%X\n", flags); */ index = GetUInt16(ptr, 2); ptr += 4; +nAvailableBytes -= 4; if( std::find( glyphlist.begin(), glyphlist.end(), index ) != glyphlist.end() ) { @@ -577,11 +600,24 @@ static int GetCompoundTTOutline(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, C GetMetrics(ttf, index, metrics); if (flags & ARG_1_AND_2_ARE_WORDS) { +if (nAvailableBytes < 4) +{ +SAL_WARN("vcl.fonts", "short read"); +free(nextComponent); +return 0; +} e = GetInt16(ptr, 0); f = GetInt16(ptr, 2); /* printf("ARG_1_AND_2_ARE_WORDS: %d %d\n", e & 0x, f & 0x); */ ptr += 4; +nAvailableBytes -= 4; } else { +if (nAvailableBytes < 2) +{ +SAL_WARN("vcl.fonts", "short read"); +free(nextComponent); +return 0; +} if (flags & ARGS_ARE_XY_VALUES) { /* args are signed */ e = static_cast(*ptr++); f = static_cast(*ptr++); @@ -591,26 +627,47 @@ static int GetCompoundTTOutline(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, C e = *ptr++; f = *ptr++; } - +nAvailableBytes -= 2; } a = d = 0x1; b = c = 0; if (flags & WE_HAVE_A_SCALE) { +if (nAvailableBytes < 2) +{ +SAL_WARN("vcl.fonts", "short read"); +free(nextComponent); +return 0; +} a = fromF2Dot14(GetInt16(ptr, 0)); d = a; ptr += 2; +nAvailableBytes -= 2; } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { +if (nAvailableBytes < 4) +{ +SAL_WARN("vcl.fonts", "short read"); +free(nextComponent); +return 0; +} a = fromF2Dot14(GetInt16(ptr, 0)); d = fromF2Dot14(GetInt16(ptr, 2)); ptr += 4; +nAvailableBytes -= 4; } else if (flags & WE_HAVE_A_TWO_BY_TWO) { +if (nAvailableBytes < 8) +{ +SAL_WARN("vcl.fonts", "short read"); +free(nextComponent); +return 0; +} a = fromF2Dot14(GetInt16(ptr, 0)); b = fromF2Dot14(GetInt16(ptr, 2)); c = fromF2Dot14(GetInt16(ptr, 4)); d = fromF2Dot14(GetInt16(ptr, 6)); ptr += 8; +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) New commits: commit fa22782df698b6b6ab19d23b99d3e213e32da942 Author: Caolán McNamara AuthorDate: Thu Mar 3 20:28:28 2022 + Commit: Michael Stahl CommitDate: Fri Mar 4 11:29:33 2022 +0100 ofz: Use-of-uninitialized-value Change-Id: If10e8d2465ef6de62583f6547e3f68e92002f3f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130864 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index ec0272027d6c..a0416a01621c 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1464,31 +1464,46 @@ int GetTTGlyphComponents(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, std::vec glyphlist.push_back( glyphID ); -const sal_uInt32 nMaxGlyphSize = glyflength - nOffset; +sal_uInt32 nRemainingData = glyflength - nOffset; -if (nMaxGlyphSize >= 10 && GetInt16(ptr, 0) == -1) { +if (nRemainingData >= 10 && GetInt16(ptr, 0) == -1) { sal_uInt16 flags, index; ptr += 10; +nRemainingData -= 10; do { +if (nRemainingData < 4) +{ +SAL_WARN("vcl.fonts", "short read"); +break; +} flags = GetUInt16(ptr, 0); index = GetUInt16(ptr, 2); ptr += 4; +nRemainingData -= 4; n += GetTTGlyphComponents(ttf, index, glyphlist); +sal_uInt32 nAdvance; if (flags & ARG_1_AND_2_ARE_WORDS) { -ptr += 4; +nAdvance = 4; } else { -ptr += 2; +nAdvance = 2; } if (flags & WE_HAVE_A_SCALE) { -ptr += 2; +nAdvance += 2; } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { -ptr += 4; +nAdvance += 4; } else if (flags & WE_HAVE_A_TWO_BY_TWO) { -ptr += 8; +nAdvance += 8; +} +if (nRemainingData < nAdvance) +{ +SAL_WARN("vcl.fonts", "short read"); +break; } +ptr += nAdvance; +nRemainingData -= nAdvance; } while (flags & MORE_COMPONENTS); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) New commits: commit 20b8e046a5e132cb0db2e833ff3e84805511efab Author: Caolán McNamara AuthorDate: Thu Mar 3 09:35:08 2022 + Commit: Michael Stahl CommitDate: Fri Mar 4 11:20:50 2022 +0100 ofz: check hmtx offset Change-Id: I650a37472c70771d40febe52efcb723195856421 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130856 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 9a9163a6787c..ec0272027d6c 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2229,12 +2229,29 @@ GlyphData *GetTTRawGlyphData(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID) } /* get advance width and left sidebearing */ +sal_uInt32 nAwOffset; +sal_uInt32 nLsboffset; if (glyphID < ttf->horzMetricCount()) { -d->aw = GetUInt16(hmtx, 4 * glyphID); -d->lsb = GetInt16(hmtx, 4 * glyphID + 2); +nAwOffset = 4 * glyphID; +nLsboffset = 4 * glyphID + 2; } else { -d->aw = GetUInt16(hmtx, 4 * (ttf->horzMetricCount() - 1)); -d->lsb = GetInt16(hmtx + ttf->horzMetricCount() * 4, (glyphID - ttf->horzMetricCount()) * 2); +nAwOffset = 4 * (ttf->horzMetricCount() - 1); +nLsboffset = (ttf->horzMetricCount() * 4) + ((glyphID - ttf->horzMetricCount()) * 2); +} + +if (nAwOffset + 2 <= hmtxlength) +d->aw = GetUInt16(hmtx, nAwOffset); +else +{ +SAL_WARN("vcl.fonts", "hmtx offset " << nAwOffset << " not available"); +d->aw = 0; +} +if (nLsboffset + 2 <= hmtxlength) +d->lsb = GetInt16(hmtx, nLsboffset); +else +{ +SAL_WARN("vcl.fonts", "hmtx offset " << nLsboffset << " not available"); +d->lsb = 0; } return d;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit a8234d497011a5b045ce263652f1465cab14e708 Author: Caolán McNamara AuthorDate: Thu Mar 3 09:26:18 2022 + Commit: Caolán McNamara CommitDate: Thu Mar 3 16:29:33 2022 +0100 ofz: Use-of-uninitialized-value Change-Id: I358d826a1dafe345f610d26d0d517a7357c838d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130854 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 124b4f249655..9a9163a6787c 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -378,7 +378,11 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI lastPoint = t; } -sal_uInt16 instLen = GetUInt16(ptr, 10 + numberOfContours*2); +sal_uInt32 nInstLenOffset = 10 + numberOfContours * 2; +if (nInstLenOffset + 2 > nMaxGlyphSize) +return 0; +sal_uInt16 instLen = GetUInt16(ptr, nInstLenOffset); + sal_uInt32 nOffset = 10 + 2 * numberOfContours + 2 + instLen; if (nOffset > nMaxGlyphSize) return 0;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) New commits: commit 8db43afcfc0aaff7059ae57022b53d492f1c806a Author: Caolán McNamara AuthorDate: Wed Mar 2 10:13:53 2022 + Commit: Caolán McNamara CommitDate: Thu Mar 3 12:28:13 2022 +0100 ofz: detect endless loop in font processing Change-Id: I4e6c61d8be15a560f43b5d37d646e7bad9739eb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130779 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 7ebe3cbe8cc3..124b4f249655 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -541,9 +541,9 @@ static int GetCompoundTTOutline(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, C if( std::find( glyphlist.begin(), glyphlist.end(), index ) != glyphlist.end() ) { -#if OSL_DEBUG_LEVEL > 1 -SAL_INFO("vcl.fonts", "Endless loop found in a compound glyph."); +SAL_WARN("vcl.fonts", "Endless loop found in a compound glyph."); +#if OSL_DEBUG_LEVEL > 1 std::ostringstream oss; oss << index << " -> ["; for( const auto& rGlyph : glyphlist ) @@ -554,6 +554,7 @@ static int GetCompoundTTOutline(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, C SAL_INFO("vcl.fonts", oss.str()); /**/ #endif +return 0; } glyphlist.push_back( index ); @@ -561,10 +562,8 @@ static int GetCompoundTTOutline(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, C if ((np = GetTTGlyphOutline(ttf, index, , nullptr, )) == 0) { /* XXX that probably indicates a corrupted font */ -#if OSL_DEBUG_LEVEL > 1 SAL_WARN("vcl.fonts", "An empty compound!"); /* assert(!"An empty compound"); */ -#endif } if( ! glyphlist.empty() ) @@ -1453,6 +1452,12 @@ int GetTTGlyphComponents(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, std::vec if (nptr <= ptr) return 0; +if (std::find(glyphlist.begin(), glyphlist.end(), glyphID) != glyphlist.end()) +{ +SAL_WARN("vcl.fonts", "Endless loop found in a compound glyph."); +return 0; +} + glyphlist.push_back( glyphID ); const sal_uInt32 nMaxGlyphSize = glyflength - nOffset;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx | 42 +++--- 1 file changed, 39 insertions(+), 3 deletions(-) New commits: commit d668c2b94cac5d3878eea51a318b80f3042b05c2 Author: Caolán McNamara AuthorDate: Wed Mar 2 09:04:00 2022 + Commit: Caolán McNamara CommitDate: Wed Mar 2 16:35:50 2022 +0100 ofz: don't read past end of record Change-Id: I9fced38faf46dce9f4cc2b96e351e7ae945d0ac1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130827 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index a5894f2f3e24..7ebe3cbe8cc3 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -339,7 +339,7 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI { sal_uInt32 nTableSize; const sal_uInt8* table = ttf->table(O_glyf, nTableSize); -sal_uInt8 flag, n; +sal_uInt8 n; int i, j, z; *pointArray = nullptr; @@ -384,7 +384,7 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI return 0; const sal_uInt8* p = ptr + nOffset; -const sal_uInt32 nBytesRemaining = nMaxGlyphSize - nOffset; +sal_uInt32 nBytesRemaining = nMaxGlyphSize - nOffset; const sal_uInt32 palen = lastPoint+1; //at a minimum its one byte per entry @@ -400,10 +400,22 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI i = 0; while (i <= lastPoint) { -flag = *p++; +if (!nBytesRemaining) +{ +SAL_WARN("vcl.fonts", "short read"); +break; +} +sal_uInt8 flag = *p++; +--nBytesRemaining; pa[i++].flags = static_cast(flag); if (flag & 8) { /*- repeat flag */ +if (!nBytesRemaining) +{ +SAL_WARN("vcl.fonts", "short read"); +break; +} n = *p++; +--nBytesRemaining; // coverity[tainted_data : FALSE] - i > lastPoint extra checks the n loop bound for (j=0; j lastPoint) {/*- if the font is really broken */ @@ -419,14 +431,26 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI z = 0; for (i = 0; i <= lastPoint; i++) { if (pa[i].flags & 0x02) { +if (!nBytesRemaining) +{ +SAL_WARN("vcl.fonts", "short read"); +break; +} if (pa[i].flags & 0x10) { z += static_cast(*p++); } else { z -= static_cast(*p++); } +--nBytesRemaining; } else if ( !(pa[i].flags & 0x10)) { +if (nBytesRemaining < 2) +{ +SAL_WARN("vcl.fonts", "short read"); +break; +} z += GetInt16(p, 0); p += 2; +nBytesRemaining -= 2; } pa[i].x = static_cast(z); } @@ -435,14 +459,26 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI z = 0; for (i = 0; i <= lastPoint; i++) { if (pa[i].flags & 0x04) { +if (!nBytesRemaining) +{ +SAL_WARN("vcl.fonts", "short read"); +break; +} if (pa[i].flags & 0x20) { z += *p++; } else { z -= *p++; } +--nBytesRemaining; } else if ( !(pa[i].flags & 0x20)) { +if (nBytesRemaining < 2) +{ +SAL_WARN("vcl.fonts", "short read"); +break; +} z += GetInt16(p, 0); p += 2; +nBytesRemaining -= 2; } pa[i].y = static_cast(z); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx | 45 +++--- 1 file changed, 34 insertions(+), 11 deletions(-) New commits: commit ec15218b322801e01e43a5879099d789875f8cc7 Author: Caolán McNamara AuthorDate: Tue Mar 1 09:15:40 2022 + Commit: Michael Stahl CommitDate: Wed Mar 2 12:52:08 2022 +0100 ofz: measure legal range from glyph offset, not table start Change-Id: I04c1036e004be678b70a7df197141970aa3c8b16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130750 Tested-by: Jenkins Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130826 Reviewed-by: Michael Stahl diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 867e00b47e0b..a5894f2f3e24 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -380,11 +380,11 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI sal_uInt16 instLen = GetUInt16(ptr, 10 + numberOfContours*2); sal_uInt32 nOffset = 10 + 2 * numberOfContours + 2 + instLen; -if (nOffset > nTableSize) +if (nOffset > nMaxGlyphSize) return 0; const sal_uInt8* p = ptr + nOffset; -const sal_uInt32 nBytesRemaining = nTableSize - nOffset; +const sal_uInt32 nBytesRemaining = nMaxGlyphSize - nOffset; const sal_uInt32 palen = lastPoint+1; //at a minimum its one byte per entry @@ -638,8 +638,8 @@ static int GetCompoundTTOutline(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, C */ static int GetTTGlyphOutline(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **pointArray, TTGlyphMetrics *metrics, std::vector< sal_uInt32 >* glyphlist) { -sal_uInt32 nSize; -const sal_uInt8 *table = ttf->table(O_glyf, nSize); +sal_uInt32 glyflength; +const sal_uInt8 *table = ttf->table(O_glyf, glyflength); sal_Int16 numberOfContours; int res; *pointArray = nullptr; @@ -650,14 +650,26 @@ static int GetTTGlyphOutline(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, Cont if (glyphID >= ttf->glyphCount()) return -1; -const sal_uInt8* ptr = table + ttf->glyphOffset(glyphID); -int length = ttf->glyphOffset(glyphID + 1) - ttf->glyphOffset(glyphID); +sal_uInt32 nNextOffset = ttf->glyphOffset(glyphID + 1); +if (nNextOffset > glyflength) +return -1; + +sal_uInt32 nOffset = ttf->glyphOffset(glyphID); +if (nOffset > nNextOffset) +return -1; +int length = nNextOffset - nOffset; if (length == 0) { /*- empty glyphs still have hmtx and vmtx metrics values */ if (metrics) GetMetrics(ttf, glyphID, metrics); return 0; } +const sal_uInt8* ptr = table + nOffset; +const sal_uInt32 nMaxGlyphSize = glyflength - nOffset; + +if (nMaxGlyphSize < 2) +return -1; + numberOfContours = GetInt16(ptr, 0); if (numberOfContours >= 0) @@ -1389,16 +1401,27 @@ int GetTTGlyphComponents(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, std::vec if (glyphID >= ttf->glyphCount()) return 0; -sal_uInt32 nSize; -const sal_uInt8* glyf = ttf->table(O_glyf, nSize); -const sal_uInt8* ptr = glyf + ttf->glyphOffset(glyphID); -const sal_uInt8* nptr = glyf + ttf->glyphOffset(glyphID + 1); +sal_uInt32 glyflength; +const sal_uInt8* glyf = ttf->table(O_glyf, glyflength); + +sal_uInt32 nNextOffset = ttf->glyphOffset(glyphID + 1); +if (nNextOffset > glyflength) +return 0; + +sal_uInt32 nOffset = ttf->glyphOffset(glyphID); +if (nOffset > nNextOffset) +return 0; + +const sal_uInt8* ptr = glyf + nOffset; +const sal_uInt8* nptr = glyf + nNextOffset; if (nptr <= ptr) return 0; glyphlist.push_back( glyphID ); -if (GetInt16(ptr, 0) == -1) { +const sal_uInt32 nMaxGlyphSize = glyflength - nOffset; + +if (nMaxGlyphSize >= 10 && GetInt16(ptr, 0) == -1) { sal_uInt16 flags, index; ptr += 10; do {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/ttcr.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit b228045cf3fb50128fd40a8f26376443ad22f874 Author: Caolán McNamara AuthorDate: Tue Mar 1 09:35:34 2022 + Commit: Caolán McNamara CommitDate: Tue Mar 1 21:25:41 2022 +0100 ofz: glyph data must be at least 10 bytes long to be useful Change-Id: I312c33c598013feced15c6f2dbcc66e493b703e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130767 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index d4ff5f413ede..86dc02206e92 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -1270,7 +1270,7 @@ static void ProcessTables(TrueTypeCreator *tt) /* printf("IDs: %d %d.\n", gd->glyphID, gd->newID); */ -if (gd->nbytes != 0) { +if (gd->nbytes >= 10) { sal_Int16 z = GetInt16(gd->ptr, 2); if (z < xMin) xMin = z;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) New commits: commit 42e50d6691f72cbe0d5c52cc5222b7f9da4d83c2 Author: Caolán McNamara AuthorDate: Mon Feb 28 20:49:20 2022 + Commit: Michael Stahl CommitDate: Tue Mar 1 18:35:25 2022 +0100 ofz: verify table offsets Change-Id: I49fa886508b3bf553d4f638bfe53c37fa3e2f338 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130683 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index baa54d3378b7..867e00b47e0b 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1654,11 +1654,20 @@ SFErrCodes CreateTTFromTTGlyphs(AbstractTrueTypeFont *ttf, /** post **/ if ((p = ttf->table(O_post, nTableSize)) != nullptr) +{ +sal_Int32 nItalic = (POST_italicAngle_offset + 4 < nTableSize) ? +GetInt32(p, POST_italicAngle_offset) : 0; +sal_Int16 nPosition = (POST_underlinePosition_offset + 2 < nTableSize) ? +GetInt16(p, POST_underlinePosition_offset) : 0; +sal_Int16 nThickness = (POST_underlineThickness_offset + 2 < nTableSize) ? +GetInt16(p, POST_underlineThickness_offset) : 0; +sal_uInt32 nFixedPitch = (POST_isFixedPitch_offset + 4 < nTableSize) ? +GetUInt32(p, POST_isFixedPitch_offset) : 0; + post = TrueTypeTableNew_post(0x0003, - GetInt32(p, POST_italicAngle_offset), - GetInt16(p, POST_underlinePosition_offset), - GetInt16(p, POST_underlineThickness_offset), - GetUInt32(p, POST_isFixedPitch_offset)); + nItalic, nPosition, + nThickness, nFixedPitch); +} else post = TrueTypeTableNew_post(0x0003, 0, 0, 0, 0);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) New commits: commit 26abdb564dad2011a298fc1253279232cb8b59cf Author: Caolán McNamara AuthorDate: Mon Feb 28 21:12:07 2022 + Commit: Caolán McNamara CommitDate: Tue Mar 1 18:23:32 2022 +0100 ofz: measure maximum possible contours Change-Id: Ie039abd835fef06514edde12b99e17360f5481a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130774 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 995c6b36373a..baa54d3378b7 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -347,7 +347,13 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI if (glyphID >= ttf->glyphCount()) return 0; -const sal_uInt8* ptr = table + ttf->glyphOffset(glyphID); +sal_uInt32 nGlyphOffset = ttf->glyphOffset(glyphID); +if (nGlyphOffset > nTableSize) +return 0; + +const sal_uInt8* ptr = table + nGlyphOffset; +const sal_uInt32 nMaxGlyphSize = nTableSize - nGlyphOffset; + const sal_Int16 numberOfContours = GetInt16(ptr, GLYF_numberOfContours_offset); if( numberOfContours <= 0 ) /*- glyph is not simple */ return 0; @@ -362,7 +368,7 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI /* determine the last point and be extra safe about it. But probably this code is not needed */ sal_uInt16 lastPoint=0; -const sal_Int32 nMaxContours = (nTableSize - 10)/2; +const sal_Int32 nMaxContours = (nMaxGlyphSize - 10)/2; if (numberOfContours > nMaxContours) return 0; for (i=0; i
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/ttcr.cxx | 33 ++--- 1 file changed, 26 insertions(+), 7 deletions(-) New commits: commit 568753f4d867c4681b762b63f9b1254f56865da4 Author: Caolán McNamara AuthorDate: Sun Feb 27 12:05:38 2022 + Commit: Michael Stahl CommitDate: Tue Mar 1 18:09:21 2022 +0100 ofz#45081 check font length Change-Id: Ib8cea70652ae90403db3546c07d24a517b1ec93e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130635 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index b9839b727f40..d4ff5f413ede 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -1308,14 +1308,21 @@ static void ProcessTables(TrueTypeCreator *tt) do { GlyphData *gd = static_cast(listCurrent(glyphlist)); -if (gd->compflag) { /* re-number all components */ +if (gd->compflag && gd->nbytes > 10) {/* re-number all components */ sal_uInt16 flags, index; sal_uInt8 *ptr = gd->ptr + 10; +size_t nRemaining = gd->nbytes - 10; do { -sal_uInt32 j; +if (nRemaining < 4) +{ +SAL_WARN("vcl.fonts", "truncated font"); +break; +} flags = GetUInt16(ptr, 0); index = GetUInt16(ptr, 2); + /* XXX use the sorted array of old to new glyphID mapping and do a binary search */ +sal_uInt32 j; for (j = 0; j < nGlyphs; j++) { if (gid[j] == index) { break; @@ -1326,20 +1333,32 @@ static void ProcessTables(TrueTypeCreator *tt) PutUInt16(static_cast(j), ptr, 2); ptr += 4; +nRemaining -= 4; +sal_uInt32 nAdvance = 0; if (flags & ARG_1_AND_2_ARE_WORDS) { -ptr += 4; +nAdvance += 4; } else { -ptr += 2; +nAdvance += 2; } if (flags & WE_HAVE_A_SCALE) { -ptr += 2; +nAdvance += 2; } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { -ptr += 4; +nAdvance += 4; } else if (flags & WE_HAVE_A_TWO_BY_TWO) { -ptr += 8; +nAdvance += 8; } + +if (nRemaining < nAdvance) +{ +SAL_WARN("vcl.fonts", "truncated font"); +break; +} + +ptr += nAdvance; +nRemaining -= nAdvance; + } while (flags & MORE_COMPONENTS); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) New commits: commit 987f34dd9a464cc6219b17f22c61c99956a2a9ed Author: Caolán McNamara AuthorDate: Sun Feb 27 12:21:47 2022 + Commit: Michael Stahl CommitDate: Tue Mar 1 18:02:00 2022 +0100 ofz#45082 Out-of-memory Change-Id: I274a6beeec0013f5b974017500fe31bcecabfa86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130637 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 4b54bda1767a..995c6b36373a 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2099,10 +2099,15 @@ GlyphData *GetTTRawGlyphData(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID) return nullptr; /* #127161# check the glyph offsets */ +sal_uInt32 nNextOffset = ttf->glyphOffset(glyphID + 1); +sal_uInt32 nOffset = ttf->glyphOffset(glyphID); +if (nNextOffset < nOffset) +return nullptr; + if (length < ttf->glyphOffset(glyphID + 1)) return nullptr; -length = ttf->glyphOffset(glyphID + 1) - ttf->glyphOffset(glyphID); +length = nNextOffset - nOffset; GlyphData* d = static_cast(malloc(sizeof(GlyphData))); assert(d != nullptr);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 8287f4a89180bba04ec8f2751ae62100dbc0fc53 Author: Caolán McNamara AuthorDate: Sat Feb 26 21:47:40 2022 + Commit: Michael Stahl CommitDate: Mon Feb 28 11:31:13 2022 +0100 ofz#45073 initialize names to NULL in case of 0 glyphs Change-Id: Ie410d2a6f3d2fcda19b1925675bd7515673b07a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130564 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 4a0044777f13..4b54bda1767a 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1589,7 +1589,7 @@ SFErrCodes CreateTTFromTTGlyphs(AbstractTrueTypeFont *ttf, /** name **/ -NameRecord *names; +NameRecord *names = nullptr; int n = GetTTNameRecords(ttf, ); name = TrueTypeTableNew_name(n, names); DisposeNameRecords(names, n);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/fontsubset/sft.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 21ea1eacd214dbaac8d0ce7f437580d535871415 Author: Caolán McNamara AuthorDate: Fri Feb 25 12:33:13 2022 + Commit: Xisco Fauli CommitDate: Fri Feb 25 15:53:25 2022 +0100 lastPoint might be 0x LIBREOFFICE-KYYAZMB9 Change-Id: Ic0d95bd39a01dc1e5e0fec83dcc2c40b3f23b747 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130462 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 86946799a001..4a0044777f13 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -379,7 +379,7 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI const sal_uInt8* p = ptr + nOffset; const sal_uInt32 nBytesRemaining = nTableSize - nOffset; -const sal_uInt16 palen = lastPoint+1; +const sal_uInt32 palen = lastPoint+1; //at a minimum its one byte per entry if (palen > nBytesRemaining || lastPoint > nBytesRemaining-1)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/app/salvtables.cxx | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) New commits: commit 6c191f339c8bd8717e01085baea93ccfb2416c82 Author: Caolán McNamara AuthorDate: Fri Jan 7 12:17:36 2022 + Commit: Adolfo Jayme Barrientos CommitDate: Sun Jan 9 13:37:04 2022 +0100 Resolves: tdf#129745 don't override child help for application frames the glue WindowInstance is created on demand, and on creation descends into any existing open dialogs and changes their help handlers. We could not descend into child dialogs, but we shouldn't change the app frame help handler anyway. Change-Id: I8d149d324f04824fbe9eec517d8c482fd96b125b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128076 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 54199b1284b3..5525ec7d39c5 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1427,7 +1427,10 @@ SalInstanceWindow::SalInstanceWindow(vcl::Window* pWindow, SalInstanceBuilder* p : SalInstanceContainer(pWindow, pBuilder, bTakeOwnership) , m_xWindow(pWindow) { -override_child_help(m_xWindow); +// tdf#129745 only override child help for the normal case, not for +// m_pBuilder of null which is the toplevel application frame case. +if (m_pBuilder) +override_child_help(m_xWindow); } void SalInstanceWindow::set_title(const OUString& rTitle) { m_xWindow->SetText(rTitle); } @@ -1528,7 +1531,13 @@ weld::ScreenShotCollection SalInstanceWindow::collect_screenshot_data() return aRet; } -SalInstanceWindow::~SalInstanceWindow() { clear_child_help(m_xWindow); } +SalInstanceWindow::~SalInstanceWindow() +{ +// tdf#129745 only undo overriding child help for the normal case, not for +// m_pBuilder of null which is the toplevel application frame case. +if (m_pBuilder) +clear_child_help(m_xWindow); +} IMPL_LINK_NOARG(SalInstanceWindow, HelpHdl, vcl::Window&, bool) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/treelist/treelistbox.cxx | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) New commits: commit 6d685f7b1d600da749679853a4ba2fd9848f05c0 Author: Caolán McNamara AuthorDate: Fri Dec 3 12:12:12 2021 + Commit: Adolfo Jayme Barrientos CommitDate: Tue Dec 7 17:23:11 2021 +0100 tdf#145604 indicate the row as the target when dropping in a visual tree and indicate between rows when dropping in a visual list, which is what we are doing for the gtk version. a visual list case is tools, customize, menu and drag and drop the assigned commands around. a visual tree case is tools, macros, organize dialogs, use libraries to create two libraries, and move to dialog and create a dialog in one library, and drop it onto the other library to move it between libraries. Change-Id: Ia8dc944c1f411b1f072ad1c8dcc755a1e44e3b05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126291 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit d6b003da6d77471e5e17a9cb6a25172d6f52da2a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126306 Reviewed-by: Adolfo Jayme Barrientos diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 197980774442..6d023c0799a4 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -2759,7 +2759,18 @@ void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, tools::Long nLine, vcl: rRenderContext.Push(); rRenderContext.SetLineColor(rSettings.GetDeactiveColor()); rRenderContext.SetFillColor(rSettings.GetDeactiveColor()); -rRenderContext.DrawRect(tools::Rectangle(Point(0, nLine), Size(nWidth, 2))); + +const bool bAsTree = GetStyle() & (WB_HASLINES | WB_HASLINESATROOT); +if (bAsTree) +{ +rRenderContext.DrawRect(tools::Rectangle(Point(0, nLine + nTempEntryHeight - 2), Size(nWidth, 2))); +rRenderContext.DrawRect(tools::Rectangle(Point(0, nLine), Size(nWidth, 2))); +} +else +{ +rRenderContext.DrawRect(tools::Rectangle(Point(0, nLine), Size(nWidth, 2))); +} + rRenderContext.Pop(); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/window/printdlg.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 6809461add683eaa49a11530445c1f4c4b3d8fe8 Author: Justin Luth AuthorDate: Tue Nov 23 09:18:20 2021 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Wed Nov 24 03:04:03 2021 +0100 tdf#129638 print preview: use new paper size after switching page This is a partial revert of LO 6.3 commit 2c23a96f7b6888c0e05fdc2aba57f03cd797b647. Change-Id: I17525d06d96779671caaa84e1e48629289453ad2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125685 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 324daa38a823477e1d1b650b5d91f3dc91c6a9af) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125466 Reviewed-by: Adolfo Jayme Barrientos diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index c69799ed1c4e..251ce6002535 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -975,6 +975,7 @@ void PrintDialog::preparePreview( bool i_bMayUseCache ) { PrinterController::PageSize aPageSize = maPController->getFilteredPageFile( mnCurPage, aMtf, i_bMayUseCache ); +aCurPageSize = aPrt->PixelToLogic(aPrt->GetPaperSizePixel(), MapMode(MapUnit::Map100thMM)); if( ! aPageSize.bFullPaper ) { Point aOff( aPrt->PixelToLogic( aPrt->GetPageOffsetPixel(), aMapMode ) );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/window/event.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 7836158294a5536bda4b2cf7193180f4a0ed8e05 Author: Michael Meeks AuthorDate: Tue Nov 23 14:25:45 2021 + Commit: Jan Holesovsky CommitDate: Tue Nov 23 22:30:05 2021 +0100 Crash around help-windows. Seems a popular way to crash: vcl::Window::ImplCallMove() vcl/source/window/event.cxx:555 vcl::Window::Show(bool, ShowFlags) [clone .localalias] /usr/include/c++/10/bits/unique_ptr.h:173 vcl::Window::Show(bool, ShowFlags) vcl/source/window/window.cxx:2345 HelpTextWindow::ImplShow() vcl/source/app/help.cxx:371 Scheduler::ProcessTaskScheduling() vcl/source/app/scheduler.cxx:495 Change-Id: I33ca0059844395c41f4d76619cca22aec81df207 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125711 Tested-by: Michael Meeks Reviewed-by: Jan Holesovsky diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx index 9fa5b3d4c71e..82c901185387 100644 --- a/vcl/source/window/event.cxx +++ b/vcl/source/window/event.cxx @@ -535,7 +535,8 @@ void Window::ImplCallMove() vcl::Window *pParent = ImplGetParent(); while( pParent ) { -if( pParent->mpWindowImpl->mpFrame != mpWindowImpl->mpFrame ) +if( pParent->mpWindowImpl && +pParent->mpWindowImpl->mpFrame != mpWindowImpl->mpFrame ) { pParentFrame = pParent->mpWindowImpl->mpFrame; break;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/control/button.cxx | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) New commits: commit 3009987854349732e726c14e54e7cc78e319e3c8 Author: Caolán McNamara AuthorDate: Thu Sep 30 14:35:14 2021 +0100 Commit: Michael Stahl CommitDate: Tue Oct 5 10:52:45 2021 +0200 Related: tdf#141633 drawing buttons to outputdevice affects later drawing since... commit 0b76e106b8054c91a7b7d793d9219f6ee9ae7d2c Author: Oliver Bolte Date: Thu Sep 4 06:42:10 2003 + INTEGRATION: CWS mt801 (1.21.132); FILE MERGED 2003/08/29 14:35:52 mt 1.21.132.1: #80064# Print button with color... In the "sample db" example (Mockup.odb) there are two buttons with a yellow background, when printed part of the table control is also incorrectly painted with a yellow background. Change-Id: I481b721801b5e1d1c78dc7a01cb20745702f5c01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122896 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 897d55618151..a6c86dea47bb 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1352,6 +1352,9 @@ void PushButton::Draw( OutputDevice* pDev, const Point& rPos, pDev->Push(); pDev->SetMapMode(); pDev->SetFont( aFont ); + +std::optional oOrigDevStyleSettings; + if ( nFlags & DrawFlags::Mono ) { pDev->SetTextColor( COL_BLACK ); @@ -1359,10 +1362,10 @@ void PushButton::Draw( OutputDevice* pDev, const Point& rPos, else { pDev->SetTextColor( GetTextColor() ); - // DecoView uses the FaceColor... AllSettings aSettings = pDev->GetSettings(); StyleSettings aStyleSettings = aSettings.GetStyleSettings(); +oOrigDevStyleSettings = aStyleSettings; if ( IsControlBackground() ) aStyleSettings.SetFaceColor( GetControlBackground() ); else @@ -1381,6 +1384,16 @@ void PushButton::Draw( OutputDevice* pDev, const Point& rPos, aRect = aDecoView.DrawButton( aRect, nButtonStyle ); ImplDrawPushButtonContent( pDev, nFlags, aRect, true, nButtonStyle ); + +// restore original settings (which are not affected by Push/Pop) after +// finished drawing +if (oOrigDevStyleSettings) +{ +AllSettings aSettings = pDev->GetSettings(); +aSettings.SetStyleSettings(*oOrigDevStyleSettings); +pDev->OutputDevice::SetSettings( aSettings ); +} + pDev->Pop(); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/treelist/iconviewimpl.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 2af7baa30da250a6f6894175e9fda130554eb4ac Author: Caolán McNamara AuthorDate: Mon Oct 4 19:46:45 2021 +0100 Commit: Xisco Fauli CommitDate: Tue Oct 5 10:28:24 2021 +0200 Resolves: tdf#143391 scrolling by an entry height taller than visible area leads to use of a rectangle with a negative height. Drop the attempted optimization, of reducing the area to copy to the min required, if the area is already shorter than the height of the area to scroll. Change-Id: Ic17d3d017f5280d1f6b655a2fc61627f512849cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122942 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/vcl/source/treelist/iconviewimpl.cxx b/vcl/source/treelist/iconviewimpl.cxx index 3b2b370ab53d..319a0d7c899e 100644 --- a/vcl/source/treelist/iconviewimpl.cxx +++ b/vcl/source/treelist/iconviewimpl.cxx @@ -46,7 +46,8 @@ void IconViewImpl::CursorUp() m_pView->PaintImmediately(); m_pStartEntry = pPrevFirstToDraw; tools::Rectangle aArea( GetVisibleArea() ); -aArea.AdjustBottom( -nEntryHeight ); +if (aArea.GetHeight() > nEntryHeight) +aArea.AdjustBottom(-nEntryHeight); m_pView->Scroll( 0, nEntryHeight, aArea, ScrollFlags::NoChildren ); m_pView->PaintImmediately(); ShowCursor( true );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/app/salvtables.cxx | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) New commits: commit 236419fb117ce8cd96d181f0b1050d7bb6020a06 Author: Caolán McNamara AuthorDate: Thu Sep 30 16:08:25 2021 +0100 Commit: Caolán McNamara CommitDate: Fri Oct 1 15:43:40 2021 +0200 Resolves: tdf#140992 Paste/Cut should mark Edit as modified Change-Id: Id56b5bf2e922394da7e730f4bab652808253c54e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122857 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index ad46c0035e95..3638db349676 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -3360,11 +3360,19 @@ Edit& SalInstanceEntry::getEntry() { return *m_xEntry; } void SalInstanceEntry::fire_signal_changed() { signal_changed(); } -void SalInstanceEntry::cut_clipboard() { m_xEntry->Cut(); } +void SalInstanceEntry::cut_clipboard() +{ +m_xEntry->Cut(); +m_xEntry->Modify(); +} void SalInstanceEntry::copy_clipboard() { m_xEntry->Copy(); } -void SalInstanceEntry::paste_clipboard() { m_xEntry->Paste(); } +void SalInstanceEntry::paste_clipboard() +{ +m_xEntry->Paste(); +m_xEntry->Modify(); +} namespace {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/window/layout.cxx |4 1 file changed, 4 insertions(+) New commits: commit bd4f890462701f9ab39f78429704d13c971fc776 Author: Caolán McNamara AuthorDate: Wed Sep 15 11:52:23 2021 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Thu Sep 30 11:07:04 2021 +0200 Resolves: tdf#143487 don't draw a border at all for DrawFrameStyle::NONE Change-Id: I7794376c9475a32276d23135365c99a3f6fb7d84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122142 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit dedb3337291c09c85262ca08bacd01e8e5901d22) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122741 Reviewed-by: Adolfo Jayme Barrientos diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index ae147dd093e5..be5b0d1ab39f 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1831,6 +1831,8 @@ VclScrolledWindow::VclScrolledWindow(vcl::Window *pParent) int VclScrolledWindow::CalcBorderWidth() const { +if (m_eDrawFrameStyle == DrawFrameStyle::NONE) +return 0; const tools::Rectangle aRect(tools::Rectangle(Point(0, 0), Size(100, 100))); DecorationView aDecoView(const_cast(GetOutDev())); // don't actually draw anything, just measure what size it would be and the diff is the desired border size to reserve @@ -2102,6 +2104,8 @@ bool VclScrolledWindow::EventNotify(NotifyEvent& rNEvt) void VclScrolledWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) { VclBin::Paint(rRenderContext, rRect); +if (m_eDrawFrameStyle == DrawFrameStyle::NONE) +return; const tools::Rectangle aRect(tools::Rectangle(Point(0,0), GetSizePixel())); DecorationView aDecoView(); const tools::Rectangle aContentRect = aDecoView.DrawFrame(aRect, m_eDrawFrameStyle, m_eDrawFrameFlags);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source vcl/unx
vcl/source/app/salvtables.cxx | 28 ++-- vcl/unx/gtk3/gtkinst.cxx | 26 -- 2 files changed, 50 insertions(+), 4 deletions(-) New commits: commit 39a6ea1fea4c0a624d19b4a5f0bcfd0e4cad0a20 Author: Caolán McNamara AuthorDate: Tue Sep 28 12:10:33 2021 +0100 Commit: Caolán McNamara CommitDate: Wed Sep 29 12:21:54 2021 +0200 tdf#144139 don't crash when OutputDevice is a printer Change-Id: Ia3843966949b8164b01cecd762ea2b5c5bf0339b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122777 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit a0f6d3865dd113f38fd3aa673075e9fecd06f3cd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122791 Reviewed-by: Michael Stahl diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index a66e95158aa4..ad46c0035e95 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1285,7 +1285,19 @@ void SalInstanceWidget::DoRecursivePaint(vcl::Window* pWindow, const Point& rRen Size aTempLogicSize(xOutput->PixelToLogic(aChildSizePixel)); Size aRenderLogicSize(rOutput.PixelToLogic(aChildSizePixel)); -xOutput->DrawOutDev(Point(), aTempLogicSize, rRenderLogicPos, aRenderLogicSize, rOutput); +switch (rOutput.GetOutDevType()) +{ +case OUTDEV_WINDOW: +case OUTDEV_VIRDEV: +xOutput->DrawOutDev(Point(), aTempLogicSize, rRenderLogicPos, aRenderLogicSize, +rOutput); +break; +case OUTDEV_PRINTER: +case OUTDEV_PDF: +xOutput->SetBackground(rOutput.GetBackground()); +xOutput->Erase(); +break; +} //set ReallyVisible to match Visible, we restore the original state after Paint WindowImpl* pImpl = pWindow->ImplGetWindowImpl(); @@ -1297,7 +1309,19 @@ void SalInstanceWidget::DoRecursivePaint(vcl::Window* pWindow, const Point& rRen pImpl->mbReallyVisible = bRVisible; -rOutput.DrawOutDev(rRenderLogicPos, aRenderLogicSize, Point(), aTempLogicSize, *xOutput); +switch (rOutput.GetOutDevType()) +{ +case OUTDEV_WINDOW: +case OUTDEV_VIRDEV: +rOutput.DrawOutDev(rRenderLogicPos, aRenderLogicSize, Point(), aTempLogicSize, + *xOutput); +break; +case OUTDEV_PRINTER: +case OUTDEV_PDF: +rOutput.DrawBitmapEx(rRenderLogicPos, aRenderLogicSize, + xOutput->GetBitmapEx(Point(), aTempLogicSize)); +break; +} xOutput.disposeAndClear(); diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 38205154be22..213ccfb8624c 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -4210,7 +4210,19 @@ public: VclPtr xOutput(VclPtr::Create(DeviceFormat::DEFAULT)); xOutput->SetOutputSizePixel(aSize); -xOutput->DrawOutDev(Point(), aSize, rPos, aSize, rOutput); + +switch (rOutput.GetOutDevType()) +{ +case OUTDEV_WINDOW: +case OUTDEV_VIRDEV: +xOutput->DrawOutDev(Point(), aSize, rPos, aSize, rOutput); +break; +case OUTDEV_PRINTER: +case OUTDEV_PDF: +xOutput->SetBackground(rOutput.GetBackground()); +xOutput->Erase(); +break; +} cairo_surface_t* pSurface = get_underlying_cairo_surface(*xOutput); cairo_t* cr = cairo_create(pSurface); @@ -4228,7 +4240,17 @@ public: gtk_widget_size_allocate(m_pWidget, , 0); #endif -rOutput.DrawOutDev(rPos, aSize, Point(), aSize, *xOutput); +switch (rOutput.GetOutDevType()) +{ +case OUTDEV_WINDOW: +case OUTDEV_VIRDEV: +rOutput.DrawOutDev(rPos, aSize, Point(), aSize, *xOutput); +break; +case OUTDEV_PRINTER: +case OUTDEV_PDF: +rOutput.DrawBitmapEx(rPos, xOutput->GetBitmapEx(Point(), aSize)); +break; +} if (bAnimations) g_object_set(pSettings, "gtk-enable-animations", true, nullptr);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/filter/ipsd/ipsd.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit da35f7f3137439b6138d7919111dbaeee0d0b327 Author: Caolán McNamara AuthorDate: Sat Aug 28 10:18:57 2021 +0100 Commit: Xisco Fauli CommitDate: Mon Aug 30 14:05:49 2021 +0200 ofz: MemorySanitizer: use-of-uninitialized-value Change-Id: Id3acc87a697a61bcf3794745846071bc99fc8d8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121157 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/vcl/source/filter/ipsd/ipsd.cxx b/vcl/source/filter/ipsd/ipsd.cxx index 623a2b14a84e..4c12770275fe 100644 --- a/vcl/source/filter/ipsd/ipsd.cxx +++ b/vcl/source/filter/ipsd/ipsd.cxx @@ -616,7 +616,7 @@ bool PSDReader::ImplReadBody() if (mpFileHeader->nMode == PSD_CMYK && m_rPSD.good()) { sal_uInt32 nBlack, nBlackMax = 0; -std::unique_ptr pBlack(new sal_uInt8[ mpFileHeader->nRows * mpFileHeader->nColumns ]); +std::vector aBlack(mpFileHeader->nRows * mpFileHeader->nColumns, 0); nY = 0; while (nY < mpFileHeader->nRows && m_rPSD.good()) { @@ -645,7 +645,7 @@ bool PSDReader::ImplReadBody() nBlack = mpBitmap->GetPixel( nY, nX ).GetBlue() + nDat; if ( nBlack > nBlackMax ) nBlackMax = nBlack; -pBlack[ nX + nY * mpFileHeader->nColumns ] = nDat ^ 0xff; +aBlack[ nX + nY * mpFileHeader->nColumns ] = nDat ^ 0xff; if ( ++nX == mpFileHeader->nColumns ) { nX = 0; @@ -672,7 +672,7 @@ bool PSDReader::ImplReadBody() nBlack = mpBitmap->GetPixel( nY, nX ).GetBlue() + nDat; if ( nBlack > nBlackMax ) nBlackMax = nBlack; -pBlack[ nX + nY * mpFileHeader->nColumns ] = nDat ^ 0xff; +aBlack[ nX + nY * mpFileHeader->nColumns ] = nDat ^ 0xff; if ( ++nX == mpFileHeader->nColumns ) { nX = 0; @@ -688,7 +688,7 @@ bool PSDReader::ImplReadBody() { for ( nX = 0; nX < mpFileHeader->nColumns; nX++ ) { -sal_Int32 nDAT = pBlack[ nX + nY * mpFileHeader->nColumns ] * ( nBlackMax - 256 ) / 0x1ff; +sal_Int32 nDAT = aBlack[ nX + nY * mpFileHeader->nColumns ] * ( nBlackMax - 256 ) / 0x1ff; aBitmapColor = mpBitmap->GetPixel( nY, nX ); sal_uInt8 cR = static_cast(MinMax( aBitmapColor.GetRed() - nDAT, 0, 255L ));
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/filter/ipcd/ipcd.cxx |5 + 1 file changed, 1 insertion(+), 4 deletions(-) New commits: commit 593d7b8dcbf8bd53377137b88416c95b3a2651c8 Author: Caolán McNamara AuthorDate: Mon Aug 23 20:01:07 2021 +0100 Commit: Xisco Fauli CommitDate: Wed Aug 25 22:46:29 2021 +0200 ofz: MemorySanitizer: use-of-uninitialized-value Change-Id: Icc09937594ddc97706a63bd11afe062a854ae8ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120921 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 6097ea726dcc087694a600cf823761097e3ba13e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120978 Reviewed-by: Michael Stahl diff --git a/vcl/source/filter/ipcd/ipcd.cxx b/vcl/source/filter/ipcd/ipcd.cxx index 10c4abc30549..b3377c8934e3 100644 --- a/vcl/source/filter/ipcd/ipcd.cxx +++ b/vcl/source/filter/ipcd/ipcd.cxx @@ -162,7 +162,6 @@ bool PCDReader::ReadPCD( Graphic & rGraphic, FilterConfigItem* pConfigItem ) return bStatus; } - void PCDReader::CheckPCDImagePacFile() { char Buf[ 8 ]; @@ -170,11 +169,10 @@ void PCDReader::CheckPCDImagePacFile() m_rPCD.Seek( 2048 ); m_rPCD.ReadBytes(Buf, 7); Buf[ 7 ] = 0; -if (Buf != std::string_view("PCD_IPI")) +if (!m_rPCD.good() || Buf != std::string_view("PCD_IPI")) bStatus = false; } - void PCDReader::ReadOrientation() { if ( !bStatus ) @@ -184,7 +182,6 @@ void PCDReader::ReadOrientation() nOrientation &= 0x03; } - void PCDReader::ReadImage() { sal_uInt32 nx,ny,nW2,nH2,nYPair,ndy,nXPair;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/filter/ieps/ieps.cxx |9 + 1 file changed, 5 insertions(+), 4 deletions(-) New commits: commit 8f7b8a6c068c6484b05edb2aac643142df6d44ac Author: Caolán McNamara AuthorDate: Mon Aug 23 20:08:48 2021 +0100 Commit: Michael Stahl CommitDate: Wed Aug 25 14:59:35 2021 +0200 ofz: MemorySanitizer: use-of-uninitialized-value Change-Id: I364368cf4f5cb68c03bbff81f42002f56e3e44af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120923 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 4556dd0f9d154c9b71b009f6dcf9f3e54d9a4d85) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120976 Reviewed-by: Michael Stahl diff --git a/vcl/source/filter/ieps/ieps.cxx b/vcl/source/filter/ieps/ieps.cxx index 946fbf30b3d7..7b5a0c96dd10 100644 --- a/vcl/source/filter/ieps/ieps.cxx +++ b/vcl/source/filter/ieps/ieps.cxx @@ -635,11 +635,12 @@ bool ImportEpsGraphic( SvStream & rStream, Graphic & rGraphic) nPSSize = rStream.Seek( STREAM_SEEK_TO_END ) - nOrigPos; } -std::unique_ptr pHeader( new sal_uInt8[ 22 ] ); +std::vector aHeader(22, 0); rStream.Seek( nPSStreamPos ); -rStream.ReadBytes(pHeader.get(), 22); // check PostScript header -bool bOk = ImplSearchEntry(pHeader.get(), reinterpret_cast("%!PS-Adobe"), 10, 10) && - ImplSearchEntry([ 15 ], reinterpret_cast("EPS"), 3, 3); +rStream.ReadBytes(aHeader.data(), 22); // check PostScript header +sal_uInt8* pHeader = aHeader.data(); +bool bOk = ImplSearchEntry(pHeader, reinterpret_cast("%!PS-Adobe"), 10, 10) && + ImplSearchEntry(pHeader + 15, reinterpret_cast("EPS"), 3, 3); if (bOk) { rStream.Seek(nPSStreamPos);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/filter/igif/gifread.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit f2602462772df03c294b6b979a18fd4f14ea626d Author: Caolán McNamara AuthorDate: Mon Aug 23 20:15:16 2021 +0100 Commit: Michael Stahl CommitDate: Wed Aug 25 14:58:27 2021 +0200 ofz: MemorySanitizer: use-of-uninitialized-value Change-Id: Iaecbdaa7a7ad61f8c657b0aa04fd30ee27699b72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120924 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 8351081be79d0b9d61aae2a6eb328a11e2393c92) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120975 Reviewed-by: Michael Stahl diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 595e5cf18183..fa1270e6a135 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -256,14 +256,14 @@ bool GIFReader::ReadGlobalHeader() charpBuf[ 7 ]; boolbRet = false; -rIStm.ReadBytes( pBuf, 6 ); -if( NO_PENDING( rIStm ) ) +auto nRead = rIStm.ReadBytes(pBuf, 6); +if (nRead == 6 && NO_PENDING(rIStm)) { pBuf[ 6 ] = 0; if( !strcmp( pBuf, "GIF87a" ) || !strcmp( pBuf, "GIF89a" ) ) { -rIStm.ReadBytes( pBuf, 7 ); -if( NO_PENDING( rIStm ) ) +nRead = rIStm.ReadBytes(pBuf, 7); +if (nRead == 7 && NO_PENDING(rIStm)) { sal_uInt8 nAspect; sal_uInt8 nRF;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/filter/ipbm/ipbm.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 47de9b2acabde7835471d57e165c1228bc07c0d3 Author: Caolán McNamara AuthorDate: Mon Aug 23 19:59:09 2021 +0100 Commit: Michael Stahl CommitDate: Wed Aug 25 14:52:57 2021 +0200 ofz: MemorySanitizer: use-of-uninitialized-value Change-Id: Ib020053b30ee7d7c0e335afac68f3a39e891cf2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120920 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit a620516fbdddc93b85430081e83fe6cecd9f8d12) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120973 Reviewed-by: Michael Stahl diff --git a/vcl/source/filter/ipbm/ipbm.cxx b/vcl/source/filter/ipbm/ipbm.cxx index 7794e611ef4c..87065a81c1ba 100644 --- a/vcl/source/filter/ipbm/ipbm.cxx +++ b/vcl/source/filter/ipbm/ipbm.cxx @@ -145,7 +145,7 @@ bool PBMReader::ImplReadHeader() boolbFinished = false; mrPBM.ReadUChar( nID[ 0 ] ).ReadUChar( nID[ 1 ] ); -if ( nID[ 0 ] != 'P' ) +if (!mrPBM.good() || nID[0] != 'P') return false; mnMaxVal = mnWidth = mnHeight = 0; switch ( nID[ 1 ] )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/filter/png/PngImageReader.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 9ebceed2e50c111655dd64dde6e8306afe1cae84 Author: Caolán McNamara AuthorDate: Mon Aug 23 20:17:42 2021 +0100 Commit: Michael Stahl CommitDate: Wed Aug 25 14:51:11 2021 +0200 ofz: MemorySanitizer: use-of-uninitialized-value Change-Id: I768cec434ee20e6e46eb3993c873bed05b3c9cc3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120925 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit a0e92a64a9a6069ee21336888f3781ffe144b2df) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120974 Reviewed-by: Michael Stahl diff --git a/vcl/source/filter/png/PngImageReader.cxx b/vcl/source/filter/png/PngImageReader.cxx index 56945e9d9c4b..80fcf7e99df3 100644 --- a/vcl/source/filter/png/PngImageReader.cxx +++ b/vcl/source/filter/png/PngImageReader.cxx @@ -55,8 +55,8 @@ bool isPng(SvStream& rStream) { // Check signature bytes sal_uInt8 aHeader[PNG_SIGNATURE_SIZE]; -rStream.ReadBytes(aHeader, PNG_SIGNATURE_SIZE); - +if (rStream.ReadBytes(aHeader, PNG_SIGNATURE_SIZE) != PNG_SIGNATURE_SIZE) +return false; return png_sig_cmp(aHeader, 0, PNG_SIGNATURE_SIZE) == 0; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/filter/iras/iras.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 9841853b8a4b4cac06f59269189f50f3f73d79ab Author: Caolán McNamara AuthorDate: Mon Aug 23 20:03:26 2021 +0100 Commit: Xisco Fauli CommitDate: Wed Aug 25 10:02:51 2021 +0200 ofz: MemorySanitizer: use-of-uninitialized-value Change-Id: I4e592de5ff830aa970b96993c79a5d957f57adfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120922 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit fe90f7fc34f8a6e354abbb48c21556d018fa768d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120977 Reviewed-by: Xisco Fauli diff --git a/vcl/source/filter/iras/iras.cxx b/vcl/source/filter/iras/iras.cxx index 128255fed025..49cfe2bef2cc 100644 --- a/vcl/source/filter/iras/iras.cxx +++ b/vcl/source/filter/iras/iras.cxx @@ -94,7 +94,7 @@ bool RASReader::ReadRAS(Graphic & rGraphic) m_rRAS.SetEndian( SvStreamEndian::BIG ); m_rRAS.ReadUInt32( nMagicNumber ); -if ( nMagicNumber != SUNRASTER_MAGICNUMBER ) +if (!m_rRAS.good() || nMagicNumber != SUNRASTER_MAGICNUMBER) return false; // Kopf einlesen:
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/filter/iras/iras.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit d230a5caa7af87b9a2f5a642e7502f5b10cd952b Author: Caolán McNamara AuthorDate: Tue Aug 24 20:47:30 2021 +0100 Commit: Xisco Fauli CommitDate: Wed Aug 25 10:00:51 2021 +0200 ofz: MemorySanitizer: use-of-uninitialized-value Change-Id: I8bac670cb289d7b8636535c1b1fb2f4fc9f03afe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120891 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/vcl/source/filter/iras/iras.cxx b/vcl/source/filter/iras/iras.cxx index 415e3224d6fb..128255fed025 100644 --- a/vcl/source/filter/iras/iras.cxx +++ b/vcl/source/filter/iras/iras.cxx @@ -365,7 +365,7 @@ bool RASReader::ImplReadBody(vcl::bitmap::RawBitmap& rBitmap, std::vector sal_uInt8 RASReader::ImplGetByte() { -sal_uInt8 nRetVal; +sal_uInt8 nRetVal(0); if ( mnType != RAS_TYPE_BYTE_ENCODED ) { m_rRAS.ReadUChar( nRetVal );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/filter/ipsd/ipsd.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 26adaed995097a160063b54a9d2a8d81b34f145d Author: Caolán McNamara AuthorDate: Mon Aug 23 17:33:10 2021 +0100 Commit: Michael Stahl CommitDate: Tue Aug 24 12:13:26 2021 +0200 ofz: MemorySanitizer: use-of-uninitialized-value Change-Id: Iea17e1d593f0003de3733722f619b10fbd90a303 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120876 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/filter/ipsd/ipsd.cxx b/vcl/source/filter/ipsd/ipsd.cxx index 08e520884754..623a2b14a84e 100644 --- a/vcl/source/filter/ipsd/ipsd.cxx +++ b/vcl/source/filter/ipsd/ipsd.cxx @@ -165,6 +165,9 @@ bool PSDReader::ImplReadHeader() m_rPSD.ReadUInt32( mpFileHeader->nSignature ).ReadUInt16( mpFileHeader->nVersion ).ReadUInt32( mpFileHeader->nPad1 ).ReadUInt16( mpFileHeader->nPad2 ).ReadUInt16( mpFileHeader->nChannels ).ReadUInt32( mpFileHeader->nRows ).ReadUInt32( mpFileHeader->nColumns ).ReadUInt16( mpFileHeader->nDepth ).ReadUInt16( mpFileHeader->nMode ); +if (!m_rPSD.good()) +return false; + if ( ( mpFileHeader->nSignature != 0x38425053 ) || ( mpFileHeader->nVersion != 1 ) ) return false;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/window/mouse.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 751053e8c998960fbe53f498eb06965b48ea7885 Author: Michael Meeks AuthorDate: Fri Jul 16 14:32:36 2021 +0100 Commit: Michael Stahl CommitDate: Tue Jul 20 11:13:13 2021 +0200 vcl: check mpWindowImpl for nullptr. Crash in calc's mouse capture / end tracking. Change-Id: If5b4cded8ebfc04d1fcf645a7b74184532ab2338 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119034 Tested-by: Jenkins Reviewed-by: Michael Meeks (cherry picked from commit c7b9f477f69c317e0482aeee79b1c2f070a1b981) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119037 Reviewed-by: Michael Stahl diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index b2f978dbe7cf..d49c7f3dbda7 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -465,7 +465,8 @@ void Window::ReleaseMouse() { ImplSVData* pSVData = ImplGetSVData(); pSVData->mpWinData->mpCaptureWin = nullptr; -mpWindowImpl->mpFrame->CaptureMouse( false ); +if (mpWindowImpl && mpWindowImpl->mpFrame) +mpWindowImpl->mpFrame->CaptureMouse( false ); ImplGenerateMouseMove(); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/window/window.cxx | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) New commits: commit cff620010dc6501669b0308866f73f5db96bc640 Author: Noel Grandin AuthorDate: Fri Jul 16 16:03:49 2021 +0200 Commit: Noel Grandin CommitDate: Mon Jul 19 12:01:25 2021 +0200 tdf#142923 Deleting comment in Writer leaves visual artifact behind Change-Id: Ia2e55886513e81847dd0ac6c697e7cea34e01bdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119075 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 3ec78de2322f781a98802acc77cfb3e71a08eb3d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119174 diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 4ec17ae8b18f..88c618dd1254 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2182,7 +2182,7 @@ vcl::Font Window::GetPointFont(vcl::RenderContext const & rRenderContext) const void Window::Show(bool bVisible, ShowFlags nFlags) { -if ( isDisposed() || mpWindowImpl->mbVisible == bVisible ) +if ( !mpWindowImpl || mpWindowImpl->mbVisible == bVisible ) return; VclPtr xWindow(this); @@ -2193,7 +2193,7 @@ void Window::Show(bool bVisible, ShowFlags nFlags) if ( !bVisible ) { ImplHideAllOverlaps(); -if( xWindow->isDisposed() ) +if( !xWindow->mpWindowImpl ) return; if ( mpWindowImpl->mpBorderWindow ) @@ -2219,7 +2219,7 @@ void Window::Show(bool bVisible, ShowFlags nFlags) vcl::Region aInvRegion = mpWindowImpl->maWinClipRegion; -if( xWindow->isDisposed() ) +if( !xWindow->mpWindowImpl ) return; bRealVisibilityChanged = mpWindowImpl->mbReallyVisible; @@ -2355,7 +2355,7 @@ void Window::Show(bool bVisible, ShowFlags nFlags) bool bNoActivate(nFlags & (ShowFlags::NoActivate|ShowFlags::NoFocusChange)); mpWindowImpl->mpFrame->Show( true, bNoActivate ); } -if( xWindow->isDisposed() ) +if( !xWindow->mpWindowImpl ) return; // Query the correct size of the window, if we are waiting for @@ -2373,13 +2373,13 @@ void Window::Show(bool bVisible, ShowFlags nFlags) mpWindowImpl->mpFrameData->mpBuffer->SetOutputSizePixel(GetOutputSizePixel()); } -if( xWindow->isDisposed() ) +if( !xWindow->mpWindowImpl ) return; ImplShowAllOverlaps(); } -if( xWindow->isDisposed() ) +if( !xWindow->mpWindowImpl ) return; // the SHOW/HIDE events also serve as indicators to send child creation/destroy events to the access bridge ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/app/salvtables.cxx |4 1 file changed, 4 deletions(-) New commits: commit 52f7bed66abed69ba30a9f699aca435fe3e54f9f Author: Caolán McNamara AuthorDate: Fri Jul 16 10:45:16 2021 +0100 Commit: Michael Stahl CommitDate: Fri Jul 16 17:05:25 2021 +0200 Resolves: tdf#143398 mouse event processed twice this is a problem since: commit 67b157e994d9bef01f6117b53fc29e1fee538715 Author: Caolán McNamara Date: Tue Jun 29 13:00:45 2021 +0100 tdf#143088 multiple Application::EventListeners is expensive turns out that AddChildEventListener is sufficient to get events for the widget and its children so the widget-only AddEventListener isn't needed or wanted Change-Id: I635419df10fce1d4441b2d85627a6cbe99adb6aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118930 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 1bab62fdf101..9b4baab77446 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -219,7 +219,6 @@ void SalInstanceWidget::ensure_mouse_listener() { if (!m_bMouseEventListener) { -m_xWidget->AddEventListener(LINK(this, SalInstanceWidget, MouseEventListener)); m_xWidget->AddChildEventListener(LINK(this, SalInstanceWidget, MouseEventListener)); m_bMouseEventListener = true; } @@ -518,10 +517,7 @@ SalInstanceWidget::~SalInstanceWidget() if (m_aMnemonicActivateHdl.IsSet()) m_xWidget->SetMnemonicActivateHdl(Link()); if (m_bMouseEventListener) -{ m_xWidget->RemoveChildEventListener(LINK(this, SalInstanceWidget, MouseEventListener)); -m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, MouseEventListener)); -} if (m_bKeyEventListener) Application::RemoveKeyListener(LINK(this, SalInstanceWidget, KeyEventListener)); if (m_bEventListener) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/treelist/svimpbox.cxx |9 + 1 file changed, 9 insertions(+) New commits: commit fc319d0872d0873ab22b98ba457fdce5cf3cb323 Author: Caolán McNamara AuthorDate: Tue Jul 13 16:56:23 2021 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Wed Jul 14 12:02:38 2021 +0200 tdf#143245 activate-on-single-click only if 'up' is at active entry which is typically selected by the 'down' Change-Id: I23382fb97146820da49e570280778729a3156f03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118806 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index 11a8fb344998..835ee2eac949 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -2017,7 +2017,16 @@ void SvImpLBox::MouseButtonUp( const MouseEvent& rMEvt) } if (m_pView->mbActivateOnSingleClick) +{ +Point aPos(rMEvt.GetPosPixel()); +SvTreeListEntry* pEntry = GetEntry(aPos); +// tdf#143245 ActivateOnSingleClick only +// if the 'up' is at the active entry +// typically selected by the 'down' +if (!pEntry || pEntry != m_pCursor) +return; m_pView->DoubleClickHdl(); +} } void SvImpLBox::MouseMove( const MouseEvent& rMEvt) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/window/window.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit e025317cc357d11e8c4afc35fbd5bacba4a07f4e Author: Michael Meeks AuthorDate: Fri Jul 9 15:14:50 2021 +0100 Commit: Michael Meeks CommitDate: Wed Jul 14 10:54:23 2021 +0200 vcl: make get_id safe for disposed windows. crash from: findChild(vcl::Window*, rtl::OUString const&, bool) include/rtl/ustring.hxx:1744 WindowUIObject::get_visible_child(rtl::OUString const&) /vcl/source/uitest/uiobject.cxx:463 lcl_sendDialogEvent ... Change-Id: Ic1756c7b03f2dee9780fb1a735917f1d0fc11876 Signed-off-by: Michael Meeks Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118691 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 303c46e2394f6b744f0df5e8e55a8e1cd8e22a91) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118802 diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index fa029f89400f..4ec17ae8b18f 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3917,7 +3917,8 @@ void Window::set_id(const OUString& rID) const OUString& Window::get_id() const { -return mpWindowImpl->maID; +static OUString empty; +return mpWindowImpl ? mpWindowImpl->maID : empty; } FactoryFunction Window::GetUITestFactory() const ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/app/salvtables.cxx |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) New commits: commit ad980a729fa5773c12339452518aa7c4e56f1fb5 Author: Caolán McNamara AuthorDate: Thu Jul 8 15:37:40 2021 +0100 Commit: Xisco Fauli CommitDate: Fri Jul 9 09:57:22 2021 +0200 SetParentToDefaultWindow doesn't change parent anymore but for SalInstanceContainer::move with a null destination we do want to move the widget out of the parent to 'somewhere else' and vcl (unlike gtk) will complain if the new parent is null so continue to use the DefaultWindow as the temporary home. Change-Id: I3d738c11c3a1c07402d1a926d890caf3e657bca2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118652 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 2b1908f55834..1bab62fdf101 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1212,10 +1212,14 @@ void SalInstanceContainer::move(weld::Widget* pWidget, weld::Container* pNewPare assert(pVclWidget); SalInstanceContainer* pNewVclParent = dynamic_cast(pNewParent); assert(!pNewParent || pNewVclParent); +vcl::Window* pVclWindow = pVclWidget->getWidget(); if (pNewVclParent) -pVclWidget->getWidget()->SetParent(pNewVclParent->getWidget()); +pVclWindow->SetParent(pNewVclParent->getWidget()); else -pVclWidget->getWidget()->SetParentToDefaultWindow(); +{ +pVclWindow->Hide(); +pVclWindow->SetParent(ImplGetDefaultWindow()); +} } void SalInstanceContainer::child_grab_focus() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/window/window.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c6a7b755425def1103a70dc9b878cb2850f54ceb Author: Michael Stahl AuthorDate: Wed Jul 7 18:00:36 2021 +0200 Commit: Michael Stahl CommitDate: Thu Jul 8 13:45:59 2021 +0200 vcl: nerf Window::SetParentToDefaultWindow() There is a problem with keyboard focus in an Eclipse RCP application on WNT; it is apparently caused by re-parenting calling ImplSalReCreateHWND() and that first transfers the focus to the newly re-created window and when that dies shortly thereafter to the Eclipse top-level window instead of LO child window. Re-parenting doesn't work anyway because mpAppWin is always null outside of unit tests and mpDefaultWin lives outside of time and space and doesn't know about any window the LO window may be embedded in. Re-parenting appears to be unnecessary because if a parent dies with undisposed children that's considered a bug anyway nowadays. (partially regression from 8a2f7704cd0e43304e54bf2281232335cc0979a3 which removed conditionals that limited the reparenting to floating windows) Change-Id: I7a3997d5e714b40918337207ec1387922f86f8e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118588 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 4c6b204fdc0cba873d33d801a9853819c09bdc6e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118621 diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index b399091bd201..fa029f89400f 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1785,7 +1785,7 @@ void Window::SetModalHierarchyHdl(const Link& rLink) void Window::SetParentToDefaultWindow() { Show(false); -SetParent(ImplGetDefaultWindow()); +// don't reparent: this window dies anyway and any children must have been disposed already } KeyIndicatorState Window::GetIndicatorState() const ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/window/window.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 3c7172bf9cfec0a8dfb103d3ab9df927407cf6ff Author: Noel Grandin AuthorDate: Thu Jul 1 14:53:00 2021 +0200 Commit: Noel Grandin CommitDate: Fri Jul 2 14:39:48 2021 +0200 tdf#142923 Deleting comment in Writer leaves visual artifact behind regression from commit 9abedad72c73ad83b66f3f8d261efdc5ce889683 Date: Sun Mar 28 10:28:45 2021 +0200 Drop Window::IsDisposed Change-Id: Ib804a1b42ea6be97b69184c76e67636f5b082974 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118224 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 29b0fa1e9cf84657abe0722d5d92d4741c9b7974) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118265 diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 5c9d7c431437..b399091bd201 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3391,7 +3391,7 @@ void Window::ImplCallDeactivateListeners( vcl::Window *pNew ) { VclPtr xWindow(this); CallEventListeners( VclEventId::WindowDeactivate, pNew ); -if( xWindow->isDisposed() ) +if( !xWindow->mpWindowImpl ) return; // #100759#, avoid walking the wrong frame's hierarchy @@ -3409,7 +3409,7 @@ void Window::ImplCallActivateListeners( vcl::Window *pOld ) VclPtr xWindow(this); CallEventListeners( VclEventId::WindowActivate, pOld ); -if( xWindow->isDisposed() ) +if( !xWindow->mpWindowImpl ) return; if ( ImplGetParent() ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/gdi/CommonSalLayout.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 744e964619b5c49870ceab7f59daf1272f24cf75 Author: Caolán McNamara AuthorDate: Tue Jun 22 17:13:39 2021 +0100 Commit: Caolán McNamara CommitDate: Wed Jun 23 10:21:39 2021 +0200 disable ligatures for monospace fonts we don't want e.g. a ffi ligature for Courier/Nimbus Mono PS Change-Id: I292c6e2ea217b511b4affcd8dab4a4bda85ab5da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117644 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 801abdd16670..50ad02843887 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -351,6 +351,12 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs, const SalLayoutGlyphsIm maFeatures.push_back({ HB_TAG('k','e','r','n'), 0, 0, static_cast(-1) }); } +if (rFontSelData.GetPitch() == PITCH_FIXED) +{ +SAL_INFO("vcl.harfbuzz", "Disabling ligatures for font: " << rFontSelData.maTargetName); +maFeatures.push_back({ HB_TAG('l','i','g','a'), 0, 0, static_cast(-1) }); +} + ParseFeatures(rFontSelData.maTargetName); double nXScale = 0; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source
vcl/source/window/winproc.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 04fc015bbf14b0b3807678cf4d63a7852508ced1 Author: Noel Grandin AuthorDate: Mon Jun 14 13:53:51 2021 +0200 Commit: Xisco Fauli CommitDate: Mon Jun 14 20:06:34 2021 +0200 tdf#142393 crash on filter by color dropdownlist (gen) the frame/window can become disposed during the early stages of this method Change-Id: I974cbeefa75a3b5274e397a6da70db8b7cf73528 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117157 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 3c0938c9bb63fa65ea44439b4e838ed0d9fa1260) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117124 Reviewed-by: Xisco Fauli diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 80e306b17625..0504ab4c7df1 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -509,6 +509,8 @@ bool ImplHandleMouseEvent( const VclPtr& xWindow, MouseNotifyEvent pMouseDownWin->ImplGetFrameData()->mbStartDragCalled = true; } +if (xWindow->isDisposed()) +return true; // test for mouseleave and mouseenter VclPtr pMouseMoveWin = pWinFrameData->mpMouseMoveWin; if ( pChild != pMouseMoveWin ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits