[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-07-25 Thread Libreoffice Gerrit user
 vcl/source/gdi/CommonSalLayout.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit fa82b6a5c74b527dc2aed9d3b63c997580cdb277
Author: Caolán McNamara 
AuthorDate: Tue Jul 24 14:47:14 2018 +0100
Commit: Eike Rathke 
CommitDate: Thu Jul 26 00:17:01 2018 +0200

forcepoint#53 restrict to expected index range

Change-Id: I22f01e5a3e3cf51b014ac841cd14071dce5baf0f
Reviewed-on: https://gerrit.libreoffice.org/57922
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index cfd86ed27409..3a7969547742 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -815,13 +815,18 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 
 bool CommonSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
 {
-int nCharCount = mnEndCharPos - mnMinCharPos;
+const int nCharCount = mnEndCharPos - mnMinCharPos;
 
 for (int i = 0; i < nCharCount; ++i)
 pCharWidths[i] = 0;
 
 for (auto const& aGlyphItem : m_GlyphItems)
-pCharWidths[aGlyphItem.mnCharPos - mnMinCharPos] += 
aGlyphItem.mnNewWidth;
+{
+const int nIndex = aGlyphItem.mnCharPos - mnMinCharPos;
+if (nIndex >= nCharCount)
+continue;
+pCharWidths[nIndex] += aGlyphItem.mnNewWidth;
+}
 
 return true;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-06-29 Thread Miklos Vajna
 vcl/source/window/status.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit bcfa971adb62bfdde14e8c328fb25e1d10acad9b
Author: Miklos Vajna 
Date:   Fri Jun 22 17:03:30 2018 +0200

tdf#116208 vcl opengl: fix lack of updates in status bar

Commit f0821f9a347c7752a3c741c3451a2f1630173720 (Cache text layout of
statusbar items, 2017-06-08) was a performance improvement of not laying
out the text of status bar text during each & every paint. One of these
places didn't work correctly with Chinese text, so commit
a4ed3d9a1ffa1b51ba4352a955c950235f099fdc (tdf#115353 Status bar: no
cache in settext, 2018-03-01) attempted to disable the caching at that
particular place by removing the update of the cache.

This resulted in lack of updates, e.g. during typing into Writer and
checking the word count part of the status bar.

Fix this (and at the same time keep the original problem fixed) by still
not using the layout cache and that problematic place, but instead of
just not updating the cache actually invalidate it -- probably that was
the intention in the force place already.

(cherry picked from commit 0ad7226aee21cc6dbb30d061d76491b01e39de66)

Change-Id: Ib7b91e5f24bc68d2f8cae2efea64340585ad9bd5
Reviewed-on: https://gerrit.libreoffice.org/56437
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index aebec55ec630..f83a8665dea1 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -1169,6 +1169,9 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const 
OUString& rText )
 std::unique_ptr pSalLayout = 
ImplLayout(pItem->maText,0,-1);
 long nWidth = GetTextWidth( 
pItem->maText,0,-1,nullptr,pSalLayout.get() ) + nFudge;
 
+// Invalidate cache.
+pItem->mxLayoutCache.reset();
+
 if( (nWidth > pItem->mnWidth + STATUSBAR_OFFSET) ||
 ((nWidth < pItem->mnWidth) && (mnDX - STATUSBAR_OFFSET) < 
mnItemsWidth  ))
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-06-19 Thread Tamas Bunth
 vcl/source/outdev/text.cxx |7 ---
 1 file changed, 7 deletions(-)

New commits:
commit 221234c0203d5b3caf6907bff110fc1a9b71a5ad
Author: Tamas Bunth 
Date:   Sun Jan 28 00:14:55 2018 +0100

tdf#114736 no need to call AdjustLayout here

Change-Id: Iae8c953155d46e53cffdf3483e3b4b95157719f6
Reviewed-on: https://gerrit.libreoffice.org/48761
Tested-by: Jenkins 
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/49033
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 5694a8165b58..6d43a5b9f9a3 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -888,13 +888,6 @@ void OutputDevice::DrawText( const Point& rStartPt, const 
OUString& rStr,
 if( mbInitFont )
 InitFont();
 
-
-OUString aStrModifiable = rStr;
-ImplLayoutArgs aLayoutArgs = ImplPrepareLayoutArgs( aStrModifiable, 
nIndex, nLen,
-0, nullptr);
-
-// position, justify, etc. the layout
-pLayoutCache->AdjustLayout( aLayoutArgs );
 pLayoutCache->DrawBase() = ImplLogicToDevicePixel( rStartPt );
 
 ImplDrawText( *pLayoutCache );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-05-23 Thread Miklos Vajna
 vcl/source/opengl/OpenGLContext.cxx |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 014a573a05bc69e0883a9e5fccdc7bed72b0a62e
Author: Miklos Vajna 
Date:   Thu May 17 17:21:40 2018 +0200

tdf#104893 vcl opengl: fix assert failure when starting chart editing

OpenGLContext::prepareForYield() assumed that in case we have a current
context, then it's the last one, but that's not the case for chart windows
since commit 78b100ec9cb0db2f7b33ece5ad3287a67a37246f (only init the OpenGL
context if we need it, 2016-06-07), which creates an OpenGLContext instance
(which is then the last one in the context list) but explicitly doesn't
initialize it (so that it would become the current one).

Fix the problem by resetting not the last but the last current context.

(cherry picked from commit 2a6171ed6fb85b3419dcf5cf1346cf1eec447987)

Change-Id: Ie0e96927473290590cd6333e5cdcb7daa009431b
Reviewed-on: https://gerrit.libreoffice.org/54516
Tested-by: Jenkins 
Reviewed-by: Bartosz Kosiorek 

diff --git a/vcl/source/opengl/OpenGLContext.cxx 
b/vcl/source/opengl/OpenGLContext.cxx
index 958c59925db2..200a772e2a36 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -483,8 +483,19 @@ void OpenGLContext::prepareForYield()
 
 SAL_INFO("vcl.opengl", "Unbinding contexts in preparation for yield");
 
-if( pCurrentCtx->isCurrent() )
-pCurrentCtx->resetCurrent();
+// Find the first context that is current and reset it.
+// Usually the last context is the current, but not in case a new
+// OpenGLContext is created already but not yet initialized.
+while (pCurrentCtx.is())
+{
+if (pCurrentCtx->isCurrent())
+{
+pCurrentCtx->resetCurrent();
+break;
+}
+
+pCurrentCtx = pCurrentCtx->mpPrevContext;
+}
 
 assert (!hasCurrent());
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-03-20 Thread Tamas Bunth
 vcl/source/gdi/sallayout.cxx |   34 +++---
 1 file changed, 23 insertions(+), 11 deletions(-)

New commits:
commit c5f0c10b3cb3d7014bb127e8d811377279ab5228
Author: Tamas Bunth 
Date:   Sat Feb 10 17:11:37 2018 +0100

tdf#115353 tdf#114743 Use first valid glyph

in AdjustLayout.

Change-Id: Iaa9a0cde2bd35fed5cbc9ebf0690341812679b6f
Reviewed-on: https://gerrit.libreoffice.org/49542
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index b8957ae14eb3..403d0b64c723 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1206,15 +1206,27 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& 
rArgs )
 double fUnitMul = 1.0;
 for( n = 0; n < nLevel; ++n )
 maFallbackRuns[n].ResetPos();
+
+int nFirstValid = -1;
+for( n = 0; n < nLevel; ++n )
+{
+if(nValid[n] > 0)
+{
+nFirstValid = n;
+break;
+}
+}
+assert(nFirstValid >= 0);
+
 // get the next codepoint index that needs fallback
-int nActiveCharPos = pGlyphs[0]->mnCharPos;
+int nActiveCharPos = pGlyphs[nFirstValid]->mnCharPos;
 int nActiveCharIndex = nActiveCharPos - mnMinCharPos;
 // get the end index of the active run
 int nLastRunEndChar = (nActiveCharIndex >= 0 && vRtl[nActiveCharIndex]) ?
 rArgs.mnEndCharPos : rArgs.mnMinCharPos - 1;
-int nRunVisibleEndChar = pGlyphs[0]->mnCharPos;
+int nRunVisibleEndChar = pGlyphs[nFirstValid]->mnCharPos;
 // merge the fallback levels
-while( nValid[0] && (nLevel > 0))
+while( nValid[nFirstValid] && (nLevel > 0))
 {
 // find best fallback level
 for( n = 0; n < nLevel; ++n )
@@ -1241,15 +1253,15 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& 
rArgs )
 {
 // drop the NotDef glyphs in the base layout run if a fallback run 
exists
 while (
-(maFallbackRuns[n-1].PosIsInRun(pGlyphs[0]->mnCharPos)) &&
-(!maFallbackRuns[n].PosIsInAnyRun(pGlyphs[0]->mnCharPos))
+
(maFallbackRuns[n-1].PosIsInRun(pGlyphs[nFirstValid]->mnCharPos)) &&
+
(!maFallbackRuns[n].PosIsInAnyRun(pGlyphs[nFirstValid]->mnCharPos))
   )
 {
 mpLayouts[0]->DropGlyph( nStartOld[0] );
 nStartOld[0] = nStartNew[0];
-nValid[0] = mpLayouts[0]->GetNextGlyphs(1, [0], aPos, 
nStartNew[0]);
+nValid[nFirstValid] = mpLayouts[0]->GetNextGlyphs(1, 
[nFirstValid], aPos, nStartNew[0]);
 
-if( !nValid[0] )
+if( !nValid[nFirstValid] )
break;
 }
 }
@@ -1301,9 +1313,9 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
 else
 {
 // break when a fallback is needed and available
-bool bNeedFallback = 
maFallbackRuns[0].PosIsInRun(pGlyphs[0]->mnCharPos);
+bool bNeedFallback = 
maFallbackRuns[0].PosIsInRun(pGlyphs[nFirstValid]->mnCharPos);
 if( bNeedFallback )
-if 
(!maFallbackRuns[nLevel-1].PosIsInRun(pGlyphs[0]->mnCharPos))
+if 
(!maFallbackRuns[nLevel-1].PosIsInRun(pGlyphs[nFirstValid]->mnCharPos))
 break;
 // break when change from resolved to unresolved base layout 
run
 if( bKeepNotDef && !bNeedFallback )
@@ -1356,7 +1368,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
   nRunAdvance -= aMultiArgs.mpDXArray[nLastRunEndChar - 
mnMinCharPos];
 }
 nLastRunEndChar = nRunVisibleEndChar;
-nRunVisibleEndChar = pGlyphs[0]->mnCharPos;
+nRunVisibleEndChar = pGlyphs[nFirstValid]->mnCharPos;
 // the requested width is still in pixel units
 // => convert it to base level font units
 nRunAdvance *= mnUnitsPerPixel;
@@ -1373,7 +1385,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
 nXPos += nRunAdvance;
 
 // prepare for next fallback run
-nActiveCharPos = pGlyphs[0]->mnCharPos;
+nActiveCharPos = pGlyphs[nFirstValid]->mnCharPos;
 // it essential that the runs don't get ahead of themselves and in the
 // if( bKeepNotDef && !bNeedFallback ) statement above, the next run 
may
 // have already been reached on the base level
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-03-07 Thread Tamas Bunth
 vcl/source/window/status.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 4fc637930e5cc7b1cc3139b0f126e3f595be809b
Author: Tamas Bunth 
Date:   Thu Mar 1 15:32:18 2018 +0100

tdf#115353 Status bar: no cache in settext

Change-Id: I6c1312bbba553be738e23cee0c76d589c809dff8
Reviewed-on: https://gerrit.libreoffice.org/50584
Reviewed-by: Tamás Bunth 
Tested-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/50743
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 11a2480323ff..aebec55ec630 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -1169,9 +1169,6 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const 
OUString& rText )
 std::unique_ptr pSalLayout = 
ImplLayout(pItem->maText,0,-1);
 long nWidth = GetTextWidth( 
pItem->maText,0,-1,nullptr,pSalLayout.get() ) + nFudge;
 
-// update cache
-pItem->mxLayoutCache = std::move(pSalLayout);
-
 if( (nWidth > pItem->mnWidth + STATUSBAR_OFFSET) ||
 ((nWidth < pItem->mnWidth) && (mnDX - STATUSBAR_OFFSET) < 
mnItemsWidth  ))
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source xmlsecurity/qa

2018-03-02 Thread Miklos Vajna
 vcl/source/filter/ipdf/pdfdocument.cxx   |4 +++-
 xmlsecurity/qa/unit/pdfsigning/data/forcepoint16.pdf |binary
 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx|2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit bea0195cecc05008b3120ef753c25c0d8d4abccc
Author: Miklos Vajna 
Date:   Fri Mar 2 11:18:21 2018 +0100

forcepoint #16: fix heap-use-after-free

PDFDocument::Tokenize() in the aKeyword == "obj" case allocates a
PDFObjectElement, stores it as an owning pointer inside rElements, and
also stores two non-owning references to it in m_aOffsetObjects and
m_aIDObjects. So make sure those 2 other containers are also cleared
then elements go away.

LO_TRACE="valgrind" bin/run pdfverify 

doesn't report errors anymore after the fix.

Change-Id: Ie103de3e24a1080257a79e53b994e8536a9597bc
Reviewed-on: https://gerrit.libreoffice.org/50631
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx 
b/vcl/source/filter/ipdf/pdfdocument.cxx
index 11c4519e44cf..a9f78fbe7f8c 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -1266,8 +1266,10 @@ bool PDFDocument::Read(SvStream& rStream)
 if (pPrev)
 nStartXRef = pPrev->GetValue();
 
-// Reset state, except object offsets and the edit buffer.
+// Reset state, except the edit buffer.
 m_aElements.clear();
+m_aOffsetObjects.clear();
+m_aIDObjects.clear();
 m_aStartXRefs.clear();
 m_aEOFs.clear();
 m_pTrailer = nullptr;
diff --git a/xmlsecurity/qa/unit/pdfsigning/data/forcepoint16.pdf 
b/xmlsecurity/qa/unit/pdfsigning/data/forcepoint16.pdf
new file mode 100644
index ..9edccb47f40c
Binary files /dev/null and 
b/xmlsecurity/qa/unit/pdfsigning/data/forcepoint16.pdf differ
diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx 
b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index c989af96f1b3..2a65ae004e43 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -450,6 +450,8 @@ void PDFSigningTest::testTokenize()
 "tdf107149.pdf",
 // Nested parentheses were not handled.
 "tdf114460.pdf",
+// Valgrind was unhappy about this.
+"forcepoint16.pdf",
 };
 
 for (const auto& rName : aNames)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-03-02 Thread Caolán McNamara
 vcl/source/helper/strhelper.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit f05b36ae263116dc72f2fe85768a967c0eded529
Author: Caolán McNamara 
Date:   Thu Mar 1 21:14:15 2018 +

forcepoint #14 check to see if we incremented at all

Change-Id: Ia4670adbddcc8501cf522be296b3061a3529f880
Reviewed-on: https://gerrit.libreoffice.org/50606
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx
index 648c579ac4c2..4d0f1d993cd6 100644
--- a/vcl/source/helper/strhelper.cxx
+++ b/vcl/source/helper/strhelper.cxx
@@ -300,9 +300,12 @@ OUString WhitespaceToSpace( const OUString& rLine, bool 
bProtect )
 *pLeap = 0;
 
 // there might be a space at beginning or end
-pLeap--;
-if( *pLeap == ' ' )
-*pLeap = 0;
+if (pLeap > pBuffer)
+{
+pLeap--;
+if( *pLeap == ' ' )
+*pLeap = 0;
+}
 
 return OUString(*pBuffer == ' ' ? pBuffer+1 : pBuffer);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-26 Thread Caolán McNamara
 vcl/source/app/svmain.cxx |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 907efefd052782387dd5985ee417b915ac9b9692
Author: Caolán McNamara 
Date:   Sat Feb 24 17:17:45 2018 +

forcepoint #6 release virtual devices before releasing font cache

Change-Id: Iacfbe7da788235c96519ecd106d09ab534c83849
Reviewed-on: https://gerrit.libreoffice.org/50284
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 2d33836aea62..8f546feb5f78 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -575,10 +575,6 @@ void DeInitVCL()
 }
 
 ImplDeletePrnQueueList();
-delete pSVData->maGDIData.mpScreenFontList;
-pSVData->maGDIData.mpScreenFontList = nullptr;
-delete pSVData->maGDIData.mpScreenFontCache;
-pSVData->maGDIData.mpScreenFontCache = nullptr;
 
 Scheduler::ImplDeInitScheduler();
 
@@ -616,6 +612,11 @@ void DeInitVCL()
 pSVData->maWinData.mpAutoScrollWin = nullptr;
 pSVData->maWinData.mpLastWheelWindow = nullptr;
 
+delete pSVData->maGDIData.mpScreenFontList;
+pSVData->maGDIData.mpScreenFontList = nullptr;
+delete pSVData->maGDIData.mpScreenFontCache;
+pSVData->maGDIData.mpScreenFontCache = nullptr;
+
 // Deinit Sal
 if (pSVData->mpDefInst)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-22 Thread Caolán McNamara
 vcl/source/gdi/pdfwriter_impl2.cxx |   27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

New commits:
commit ffdb0cfe9015609653d5add1220edb111de37317
Author: Caolán McNamara 
Date:   Tue Feb 20 21:18:04 2018 +

forcepoint #4

Thanks to Antti Levomäki and Christian Jalio from Forcepoint.

Change-Id: I569ca80267ad9b5a21da0029ba903d2a4c45a035
Reviewed-on: https://gerrit.libreoffice.org/50085
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx 
b/vcl/source/gdi/pdfwriter_impl2.cxx
index 18ff07afc556..9bc58989a46c 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -1604,11 +1604,8 @@ inline bool isSet( const Scanline i_pLine, long i_nIndex 
)
 return (i_pLine[ i_nIndex/8 ] & (0x80 >> (i_nIndex&7))) != 0;
 }
 
-long findBitRun( const Scanline i_pLine, long i_nStartIndex, long i_nW, bool 
i_bSet )
+long findBitRunImpl( const Scanline i_pLine, long i_nStartIndex, long i_nW, 
bool i_bSet )
 {
-if( i_nStartIndex < 0 )
-return i_nW;
-
 long nIndex = i_nStartIndex;
 if( nIndex < i_nW )
 {
@@ -1670,6 +1667,24 @@ long findBitRun( const Scanline i_pLine, long 
i_nStartIndex, long i_nW, bool i_b
 return nIndex < i_nW ? nIndex : i_nW;
 }
 
+long findBitRun(const Scanline i_pLine, long i_nStartIndex, long i_nW, bool 
i_bSet)
+{
+if (i_nStartIndex < 0)
+return i_nW;
+
+return findBitRunImpl(i_pLine, i_nStartIndex, i_nW, i_bSet);
+}
+
+long findBitRun(const Scanline i_pLine, long i_nStartIndex, long i_nW)
+{
+if (i_nStartIndex < 0)
+return i_nW;
+
+const bool bSet = i_nStartIndex < i_nW && isSet(i_pLine, i_nStartIndex);
+
+return findBitRunImpl(i_pLine, i_nStartIndex, i_nW, bSet);
+}
+
 struct BitStreamState
 {
 sal_uInt8   mnBuffer;
@@ -1973,7 +1988,7 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess const 
* i_pBitmap )
 long nRefIndex1 = bRefSet ? 0 : findBitRun( pRefLine, 0, nW, bRefSet );
 for( ; nLineIndex < nW; )
 {
-long nRefIndex2 = findBitRun( pRefLine, nRefIndex1, nW, isSet( 
pRefLine, nRefIndex1 ) );
+long nRefIndex2 = findBitRun( pRefLine, nRefIndex1, nW );
 if( nRefIndex2 >= nRunIndex1 )
 {
 long nDiff = nRefIndex1 - nRunIndex1;
@@ -2003,7 +2018,7 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess const 
* i_pBitmap )
 {   // difference too large, horizontal coding
 // emit horz code 001
 putG4Bits( 3, 0x1, aBitState );
-long nRunIndex2 = findBitRun( pCurLine, nRunIndex1, nW, 
isSet( pCurLine, nRunIndex1 ) );
+long nRunIndex2 = findBitRun( pCurLine, nRunIndex1, nW );
 bool bWhiteFirst = ( nLineIndex + nRunIndex1 == 0 || ! 
isSet( pCurLine, nLineIndex ) );
 putG4Span( nRunIndex1 - nLineIndex, bWhiteFirst, aBitState 
);
 putG4Span( nRunIndex2 - nRunIndex1, ! bWhiteFirst, 
aBitState );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-21 Thread Telesto
 vcl/source/window/window.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fcbcbe607ba3c693c79b1e1c390fab3b4643e3d9
Author: Telesto 
Date:   Fri Feb 16 13:44:38 2018 +0200

tdf#115315 Cursor not in focus with new document

Partial revert of 7aae8772aa18744cb1bbd8348272be99cc882c47
("Clear VclPtr instance reference on removed UserEvents.")
Disposing of child controls should not affect focus events
of the parent frame.

Change-Id: I583311050560a2851cfcc372741b675b52375d06
Reviewed-on: https://gerrit.libreoffice.org/49855
Reviewed-by: Maxim Monastirsky 
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
(cherry picked from commit 11fab5aeaaa72012c63b2c812656a932ef0debf9)
Reviewed-on: https://gerrit.libreoffice.org/49869
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index a3310a5b4976..4a6cab270591 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -486,7 +486,7 @@ void Window::dispose()
 if ( pSVData->maWinData.mpLastDeacWin == this )
 pSVData->maWinData.mpLastDeacWin = nullptr;
 
-if ( mpWindowImpl->mpFrameData )
+if ( mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData )
 {
 if ( mpWindowImpl->mpFrameData->mnFocusId )
 Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnFocusId 
);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-09 Thread Caolán McNamara
 vcl/source/fontsubset/sft.cxx |   95 +++---
 1 file changed, 71 insertions(+), 24 deletions(-)

New commits:
commit b45973d30740a7103f32f731a37554736308c6ed
Author: Caolán McNamara 
Date:   Wed Feb 7 17:17:14 2018 +

various sft fixes

use ptr diff rather than int

(cherry picked from commit 5b426038a7befcaf0d05824ffb20200ff8833ad3)

fix mem leak

(cherry picked from commit 603cb6cf31a5212d03736a552770e5734b0e8066)

check more table sizes

(cherry picked from commit 1828490bb22f1c8273c4a9f5b1db819b173ca70d)

check cmap offset

(cherry picked from commit 683d9883ad8fd6568e6a7832e5bb347c1d043e4b)

check tableoffset against size

(cherry picked from commit ae73c3ff112e1ed38eb4678ac5745990661a2e66)

check ntables offset

(cherry picked from commit 75a171a405afd6eac236af93aa9d29a9c3ec9c64)

use safeint on calculations

(cherry picked from commit 139b6c6cf898467098f3a6f29fa84013a182285f)

simplify returns

(cherry picked from commit e8b2aad1cb2107304761e68aa380b5c29d8ef22f)

extend to cover the last byte needed

(cherry picked from commit c7b0117f26a386c98a721ff3897479c268103d74)

bounds check

(cherry picked from commit bb32616bdd6e3b327654bab0e1d790d8d50b893d)

move largest bounds check to start

(cherry picked from commit f832198e6a33052c7cc86b25843badfb962a2ae8)

Change-Id: Ia174fd94c57cc3c899c10e1c0dc5968965a50427
0d329357ac282d4652b0f7ebc401cbd51963461b
004a6d322f60d916cc4635b362ce948e8a10d7c7
5aae26c38f3645020f0e1d6d7b6877c2727af1b4
a79be052dd3f6b6ed38fb326558924c853af5fff
d75f5f4b578fd176c17e5763569f1403260c6594
c063786ba41aa9a985f505e62b43d3d543a0d48f
1a67cb2f1c686032438852fec1267a59fbd04d7f
5177d42b47a4bca614878dce4a69ab16b5cfe163
6d32a6b6f1dd91db42a3f154700ea55603f0e4dd
03fe80f9568759b829fac4e9bcfd496efebe6a26
Reviewed-on: https://gerrit.libreoffice.org/49484
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 4a44fd316bee..365b9401b95e 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -38,7 +38,7 @@
 #include "xlat.hxx"
 #include 
 #include 
-
+#include 
 #include 
 #include 
 
@@ -1320,6 +1320,13 @@ static void FindCmap(TrueTypeFont *ttf)
 }
 
 if (ttf->cmapType != CMAP_NOT_USABLE) {
+if( (ttf->cmap - ttf->ptr + 2U) > static_cast(ttf->fsize) 
) {
+ttf->cmapType = CMAP_NOT_USABLE;
+ttf->cmap = nullptr;
+}
+}
+
+if (ttf->cmapType != CMAP_NOT_USABLE) {
 switch (GetUInt16(ttf->cmap, 0)) {
 case 0: ttf->mapper = getGlyph0; break;
 case 2: ttf->mapper = getGlyph2; break;
@@ -1443,10 +1450,41 @@ int OpenTTFontBuffer(const void* pBuffer, sal_uInt32 
nLen, sal_uInt32 facenum, T
 return doOpenTTFont( facenum, *ttf );
 }
 
+namespace {
+
+bool withinBounds(sal_uInt32 tdoffset, sal_uInt32 moreoffset, sal_uInt32 len, 
sal_uInt32 available)
+{
+sal_uInt32 result;
+if (o3tl::checked_add(tdoffset, moreoffset, result))
+return false;
+if (o3tl::checked_add(result, len, result))
+return false;
+return result <= available;
+}
+
+class TTFontCloser
+{
+TrueTypeFont* m_font;
+public:
+TTFontCloser(TrueTypeFont* t)
+: m_font(t)
+{
+}
+void clear() { m_font = nullptr; }
+~TTFontCloser()
+{
+if (m_font)
+CloseTTFont(m_font);
+}
+};
+
+}
+
 static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
 {
+TTFontCloser aCloseGuard(t);
+
 if (t->fsize < 4) {
-CloseTTFont(t);
 return SF_TTFORMAT;
 }
 int i;
@@ -1460,24 +1498,28 @@ static int doOpenTTFont( sal_uInt32 facenum, 
TrueTypeFont* t )
 } else if (TTCTag == T_otto) { /* PS-OpenType font 
*/
 tdoffset = 0;
 } else if (TTCTag == T_ttcf) { /* TrueType 
collection */
+if (!withinBounds(12, 4 * facenum, sizeof(sal_uInt32), t->fsize)) {
+return SF_FONTNO;
+}
 sal_uInt32 Version = GetUInt32(t->ptr, 4);
 if (Version != 0x0001 && Version != 0x0002) {
-CloseTTFont(t);
 return SF_TTFORMAT;
 }
 if (facenum >= GetUInt32(t->ptr, 8)) {
-CloseTTFont(t);
 return SF_FONTNO;
 }
 tdoffset = GetUInt32(t->ptr, 12 + 4 * facenum);
 } else {
-CloseTTFont(t);
 return SF_TTFORMAT;
 }
 
-t->ntables = GetUInt16(t->ptr + tdoffset, 4);
-if( t->ntables >= 128 )
+if (withinBounds(tdoffset, 0, 4 + sizeof(sal_uInt16), t->fsize)) {
+t->ntables = GetUInt16(t->ptr + tdoffset, 4);
+}
+
+if (t->ntables >= 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-09 Thread Caolán McNamara
 vcl/source/fontsubset/sft.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 74b11a0bae4a796c41264a6e33162c82556671e5
Author: Caolán McNamara 
Date:   Wed Feb 7 16:44:43 2018 +

check O_hhea and O_vhea sizes

Change-Id: I82e47732815f0112801c8c3a3e5b0b09ac25610a
Reviewed-on: https://gerrit.libreoffice.org/49438
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 10764a263907..4a44fd316bee 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1445,8 +1445,10 @@ int OpenTTFontBuffer(const void* pBuffer, sal_uInt32 
nLen, sal_uInt32 facenum, T
 
 static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
 {
-if (t->fsize < 4)
+if (t->fsize < 4) {
+CloseTTFont(t);
 return SF_TTFORMAT;
+}
 int i;
 sal_uInt32 length, tag;
 sal_uInt32 tdoffset = 0;/* offset to TableDirectory in a TTC file. 
For TTF files is 0 */
@@ -1627,10 +1629,12 @@ static int doOpenTTFont( sal_uInt32 facenum, 
TrueTypeFont* t )
 }
 
 table = getTable(t, O_hhea);
-t->numberOfHMetrics = (table != nullptr) ? GetUInt16(table, 34) : 0;
+table_size = getTableSize(t, O_hhea);
+t->numberOfHMetrics = (table && table_size >= 36) ? GetUInt16(table, 34) : 
0;
 
 table = getTable(t, O_vhea);
-t->numOfLongVerMetrics = (table != nullptr) ? GetUInt16(table, 34) : 0;
+table_size = getTableSize(t, O_vhea);
+t->numOfLongVerMetrics = (table && table_size >= 36) ? GetUInt16(table, 
34) : 0;
 
 GetNames(t);
 FindCmap(t);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-09 Thread Caolán McNamara
 vcl/source/fontsubset/sft.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 38666ba87c8f71032b237e89742b52a21b73ad51
Author: Caolán McNamara 
Date:   Wed Feb 7 15:50:35 2018 +

check O_head size

Change-Id: Idf5d30eaed0196cfa9266e35131c538c606a0960
Reviewed-on: https://gerrit.libreoffice.org/49365
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit b10ae2faae6f3c448bbab71585550387e18cc248)
Reviewed-on: https://gerrit.libreoffice.org/49366
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 74bf0ff307f1..10764a263907 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1450,7 +1450,6 @@ static int doOpenTTFont( sal_uInt32 facenum, 
TrueTypeFont* t )
 int i;
 sal_uInt32 length, tag;
 sal_uInt32 tdoffset = 0;/* offset to TableDirectory in a TTC file. 
For TTF files is 0 */
-int indexfmt;
 
 sal_uInt32 TTCTag = GetInt32(t->ptr, 0);
 
@@ -1590,8 +1589,13 @@ static int doOpenTTFont( sal_uInt32 facenum, 
TrueTypeFont* t )
 t->nglyphs = table_size >= 6 ? GetUInt16(table, 4) : 0;
 
 table = getTable(t, O_head);
+table_size = getTableSize(t, O_head);
+if (table_size < 52) {
+CloseTTFont(t);
+return SF_TTFORMAT;
+}
 t->unitsPerEm = GetUInt16(table, 18);
-indexfmt = GetInt16(table, 50);
+int indexfmt = GetInt16(table, 50);
 
 if( ((indexfmt != 0) && (indexfmt != 1)) || (t->unitsPerEm <= 0) ) {
 CloseTTFont(t);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-09 Thread Caolán McNamara
 vcl/source/fontsubset/sft.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit ac09d2fe176fe936d3056b94c07869cfd45e698f
Author: Caolán McNamara 
Date:   Wed Feb 7 15:33:36 2018 +

check table size before reading nglyphs

Change-Id: Ib511fdf16006877ca76085137eb9200601b2f8f7
Reviewed-on: https://gerrit.libreoffice.org/49363
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 08dd51bfcaa6b493e134bcc7787cc18c36ad5db1)
Reviewed-on: https://gerrit.libreoffice.org/49435
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 1bf9b9003de5..74bf0ff307f1 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1586,7 +1586,8 @@ static int doOpenTTFont( sal_uInt32 facenum, 
TrueTypeFont* t )
 }
 
 const sal_uInt8* table = getTable(t, O_maxp);
-t->nglyphs = GetUInt16(table, 4);
+sal_uInt32 table_size = getTableSize(t, O_maxp);
+t->nglyphs = table_size >= 6 ? GetUInt16(table, 4) : 0;
 
 table = getTable(t, O_head);
 t->unitsPerEm = GetUInt16(table, 18);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-08 Thread Xisco Fauli
 vcl/source/outdev/text.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit 392206f0449f9baa987d28cf509eccfa33700330
Author: Xisco Fauli 
Date:   Mon Feb 5 16:51:59 2018 +0100

tdf#112990: Hack-around: Do not crash on mac with opengl enabled

Change-Id: Id8d1ffe593fa42b7e37e26e8d66ffad87d6685c1
Reviewed-on: https://gerrit.libreoffice.org/49251
Tested-by: Jenkins 
Reviewed-by: Tamás Bunth 
(cherry picked from commit c83d2ac99dc3da4ef85b193543a93e02e3858844)
Reviewed-on: https://gerrit.libreoffice.org/49442
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 1d93f7730aae..5694a8165b58 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -861,6 +862,14 @@ void OutputDevice::DrawText( const Point& rStartPt, const 
OUString& rStr,
 if(mpFontInstance->mpConversion)
 pLayoutCache = nullptr;
 
+#ifdef MACOSX
+// FIXME: tdf#112990
+// Cache text layout crashes on mac with OpenGL enabled
+// Force it to not use the cache
+if(OpenGLHelper::isVCLOpenGLEnabled())
+pLayoutCache = nullptr;
+#endif
+
 // without cache
 if(!pLayoutCache)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-08 Thread Caolán McNamara
 vcl/source/fontsubset/sft.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 96af996b06f980006414dedcecc96978f5a31779
Author: Caolán McNamara 
Date:   Wed Feb 7 16:20:54 2018 +

return early on short stream

Change-Id: Ia9cb4dec5358281322a2428c5f2153836a1ee1af
Reviewed-on: https://gerrit.libreoffice.org/49374
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 5c7929b76615..7c35d3207e0d 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1521,6 +1521,8 @@ int OpenTTFontBuffer(const void* pBuffer, sal_uInt32 
nLen, sal_uInt32 facenum, T
 
 static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
 {
+if (t->fsize < 4)
+return SF_TTFORMAT;
 int i;
 sal_uInt32 length, tag;
 sal_uInt32 tdoffset = 0;/* offset to TableDirectory in a TTC file. 
For TTF files is 0 */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-08 Thread Caolán McNamara
 vcl/source/fontsubset/sft.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit fa83c595e48d74d686b3ed894d3d4893d82975c9
Author: Caolán McNamara 
Date:   Wed Feb 7 16:05:08 2018 +

stay within font bounds

Change-Id: Ie8ed610b71cb1b20963827c2be97155d2d8aa22c
Reviewed-on: https://gerrit.libreoffice.org/49370
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index d69a6132d938..5c7929b76615 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1560,7 +1560,12 @@ static int doOpenTTFont( sal_uInt32 facenum, 
TrueTypeFont* t )
 /* parse the tables */
 for (i=0; i<(int)t->ntables; i++) {
 int nIndex;
-tag = GetUInt32(t->ptr + tdoffset + 12, 16 * i);
+const sal_uInt32 nStart = tdoffset + 12;
+const sal_uInt32 nOffset = 16 * i;
+if (nStart + nOffset + sizeof(sal_uInt32) <=  
static_cast(t->fsize))
+tag = GetUInt32(t->ptr + nStart, nOffset);
+else
+tag = static_cast(-1);
 switch( tag ) {
 case T_maxp: nIndex = O_maxp; break;
 case T_glyf: nIndex = O_glyf; break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-08 Thread Caolán McNamara
 vcl/source/fontsubset/sft.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit c21f8635d7814fc6e05169cbac0a49b67f71
Author: Caolán McNamara 
Date:   Wed Feb 7 16:51:32 2018 +

what matters is the availability of the last element, not the first

Change-Id: I23d3abdbe62b735d66261fb337613da88cc4206b
Reviewed-on: https://gerrit.libreoffice.org/49379
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index b66324a5a730..d69a6132d938 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -2433,7 +2433,8 @@ void GetTTGlobalFontInfo(TrueTypeFont *ttf, 
TTGlobalFontInfo *info)
 info->symbolEncoded = (ttf->cmapType == CMAP_MS_Symbol);
 
 const sal_uInt8* table = getTable(ttf, O_OS2);
-if (table) {
+sal_uInt32 table_size = getTableSize(ttf, O_OS2);
+if (table && table_size >= 42) {
 info->weight = GetUInt16(table, 4);
 info->width  = GetUInt16(table, 6);
 
@@ -2441,7 +2442,7 @@ void GetTTGlobalFontInfo(TrueTypeFont *ttf, 
TTGlobalFontInfo *info)
  * Microsoft old (78 bytes long) and Microsoft new (86 bytes long,)
  * Apple's documentation recommends looking at the table length.
  */
-if (getTableSize(ttf, O_OS2) > 68) {
+if (table_size >= 78) {
 info->typoAscender = XUnits(UPEm,GetInt16(table, 68));
 info->typoDescender = XUnits(UPEm, GetInt16(table, 70));
 info->typoLineGap = XUnits(UPEm, GetInt16(table, 72));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-08 Thread Caolán McNamara
 vcl/source/fontsubset/sft.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit eb1d8f4abf22b627faf4fd0cf58a4f2e7fa317d2
Author: Caolán McNamara 
Date:   Wed Feb 7 16:57:27 2018 +

check kern table size

Change-Id: I65b5f0a8950d54c00d6fd7c385ca1c5dca2ef2c8
Reviewed-on: https://gerrit.libreoffice.org/49383
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 1a4f5f16e4ef..b66324a5a730 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1348,7 +1348,7 @@ static void GetKern(TrueTypeFont *ttf)
 if( !table )
 goto badtable;
 
-if (GetUInt16(table, 0) == 0) {/* 
Traditional Microsoft style table with sal_uInt16 version and nTables fields */
+if (nTableSize >= 4 && GetUInt16(table, 0) == 0) { /* Traditional 
Microsoft style table with sal_uInt16 version and nTables fields */
 ttf->nkern = GetUInt16(table, 2);
 ptr = table + 4;
 
@@ -1379,7 +1379,7 @@ static void GetKern(TrueTypeFont *ttf)
 return;
 }
 
-if (GetUInt32(table, 0) == 0x0001) {   /* MacOS 
style kern tables: fixed32 version and sal_uInt32 nTables fields */
+if (nTableSize >= 8 && GetUInt32(table, 0) == 0x0001) { /* MacOS style 
kern tables: fixed32 version and sal_uInt32 nTables fields */
 ttf->nkern = GetUInt32(table, 4);
 ptr = table + 8;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-07 Thread Caolán McNamara
 vcl/source/fontsubset/sft.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit a94ff76521463e7d37840c422c6350edef40bf6b
Author: Caolán McNamara 
Date:   Wed Feb 7 12:29:32 2018 +

sanity check cmap table size

Change-Id: I010c2fd221bcd86a62efd9996a0c34930828cb6d
Reviewed-on: https://gerrit.libreoffice.org/49349
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 098d54b41b2d..1a4f5f16e4ef 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1225,6 +1225,12 @@ static void FindCmap(TrueTypeFont *ttf)
 {
 const sal_uInt8* table = getTable(ttf, O_cmap);
 sal_uInt32 table_size = getTableSize(ttf, O_cmap);
+if (table_size < 4)
+{
+SAL_WARN("vcl.fonts", "Parsing error in " << 
OUString::createFromAscii(ttf->fname) <<
+ "cmap table size too short");
+return;
+}
 sal_uInt16 ncmaps = GetUInt16(table, 2);
 sal_uInt32 AppleUni   = 0;  // Apple Unicode
 sal_uInt32 ThreeZero  = 0;  /* MS Symbol*/
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-05 Thread Caolán McNamara
 vcl/source/filter/jpeg/jpegc.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit cd855591f49d688e116c3da63d913315c62028c1
Author: Caolán McNamara 
Date:   Sat Feb 3 16:39:12 2018 +

tdf#115416 allow build with classic libjpeg

Change-Id: I96252e1a78dbc52d21095e11b7bdb0807e5d76b6
Reviewed-on: https://gerrit.libreoffice.org/49205
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx
index e120fc304228..1210cb34ad53 100644
--- a/vcl/source/filter/jpeg/jpegc.cxx
+++ b/vcl/source/filter/jpeg/jpegc.cxx
@@ -244,6 +244,7 @@ void ReadJPEG(JpegStuff& rContext, JPEGReader* pJPEGReader, 
void* pInputStream,
 eScanlineFormat = ScanlineFormat::N8BitPal;
 nPixelSize = 1;
 }
+#if defined(JCS_EXTENSIONS)
 else if (eFinalFormat == ScanlineFormat::N32BitTcBgra)
 {
 best_out_color_space = JCS_EXT_BGRA;
@@ -262,7 +263,7 @@ void ReadJPEG(JpegStuff& rContext, JPEGReader* pJPEGReader, 
void* pInputStream,
 eScanlineFormat = eFinalFormat;
 nPixelSize = 4;
 }
-
+#endif
 if (rContext.cinfo.jpeg_color_space == JCS_YCCK)
 rContext.cinfo.out_color_space = JCS_CMYK;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-02-04 Thread Mike Kaganski
 vcl/source/window/dialog.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 3f4b0788ba688dbdf7d4487b7ef83edc7e81c1e8
Author: Mike Kaganski 
Date:   Mon Jan 22 09:34:47 2018 +0300

tdf#32935 tdf#49134 tdf#114466 Activate newly opened modal dialogs

... based on ForceFocusAndToFront setting

Change-Id: Ic76faa082f433d5a0150e49c30d7eda3c6c24c5f
Reviewed-on: https://gerrit.libreoffice.org/48287
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 
Reviewed-on: https://gerrit.libreoffice.org/49214
Reviewed-by: Andras Timar 

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 4db7c9674a83..13c8cf491b8e 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -838,7 +839,11 @@ bool Dialog::ImplStartExecuteModal()
 // FIXME: no layouting, workaround some clipping issues
 ImplAdjustNWFSizes();
 
-Show();
+css::uno::Reference< css::uno::XComponentContext > xContext(
+comphelper::getProcessComponentContext());
+bool 
bForceFocusAndToFront(officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get(xContext));
+ShowFlags showFlags = bForceFocusAndToFront ? ShowFlags::ForegroundTask : 
ShowFlags::NONE;
+Show(true, showFlags);
 
 pSVData->maAppData.mnModalMode++;
 return true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-01-29 Thread Caolán McNamara
 vcl/source/window/seleng.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2663df310f3857b9334ac78663197e3c9edc281c
Author: Caolán McNamara 
Date:   Wed Jan 24 17:18:35 2018 +

gtk3: single click with selection set doesn't unselect

this is a safe backportable fix, the unconditional

nFlags |= SelectionEngineFlags::CMDEVT

looks the real dubious thing to me, but only the gtk3 backend has swipe 
support
so just returning immediately on a swipe definitely ok

Change-Id: Iade26d0d9260ce76dfb2766ac9e5ca9fa9275bf4
Reviewed-on: https://gerrit.libreoffice.org/48529
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx
index c911a9059551..c545824436cd 100644
--- a/vcl/source/window/seleng.cxx
+++ b/vcl/source/window/seleng.cxx
@@ -342,7 +342,7 @@ void SelectionEngine::Reset()
 void SelectionEngine::Command( const CommandEvent& rCEvt )
 {
 // Timer aWTimer is active during enlarging a selection
-if ( !pFunctionSet || !pWin || aWTimer.IsActive() )
+if ( !pFunctionSet || !pWin || aWTimer.IsActive() || rCEvt.GetCommand() == 
CommandEventId::Swipe )
 return;
 aWTimer.Stop();
 nFlags |= SelectionEngineFlags::CMDEVT;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-01-27 Thread Maxim Monastirsky
 vcl/source/window/brdwin.cxx   |4 ++--
 vcl/source/window/dockmgr.cxx  |2 +-
 vcl/source/window/floatwin.cxx |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit a658ed6be2072b54fa0ec4759f24c00639145a06
Author: Maxim Monastirsky 
Date:   Wed Jan 17 21:08:59 2018 +0200

tdf#115057 Never use ImplPopupFloatWin for anything except ToolBox

ImplPopupFloatWin draws the window title and frame directly on the client
window, which is incompatible with .ui layouts, as they try to occupy the
whole available space. Instead just use a plain FloatingWindow whenever
possible, and change the border window code to mimic the behavior of
ImplPopupFloatWin, wrt removing part of the frame of toolbar popups w/o a
title.

Change-Id: If72ea89e31f913470faad7fcb8083f9b9787c9a8
Reviewed-on: https://gerrit.libreoffice.org/48094
Reviewed-by: Maxim Monastirsky 
Tested-by: Maxim Monastirsky 
(cherry picked from commit 829b0564959411d0cc64169fe69153a714050c0d)
Reviewed-on: https://gerrit.libreoffice.org/48202
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index c929d0be35f8..5d8b14c7cde9 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -1418,7 +1418,7 @@ void 
ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, con
 vcl::Region oldClipRgn(rRenderContext.GetClipRegion());
 
 // for popups, don't draw part of the frame
-if (pData->mnTitleType == BorderWindowTitleType::Popup)
+if (pData->mnTitleType >= BorderWindowTitleType::Popup)
 {
 FloatingWindow* pWin = 
dynamic_cast(pData->mpBorderWindow->GetWindow(GetWindowType::Client));
 if (pWin)
@@ -1444,7 +1444,7 @@ void 
ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, con
 --aInRect.Bottom();
 
 // restore
-if (pData->mnTitleType == BorderWindowTitleType::Popup)
+if (pData->mnTitleType >= BorderWindowTitleType::Popup)
 rRenderContext.SetClipRegion(oldClipRgn);
 
 // Draw Border
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index ef290c642ced..57b83e568215 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -933,7 +933,7 @@ void ImplDockingWindowWrapper::ImplPreparePopupMode( 
FloatWinPopupFlags nFlags )
 mpOldBorderWin = nullptr;  // no border window found
 
 bool bAllowTearOff = bool( nFlags & FloatWinPopupFlags::AllowTearOff );
-bool bUseStdPopup = bAllowTearOff && GetWindow()->GetType() != 
WindowType::TOOLBOX;
+bool bUseStdPopup = GetWindow()->GetType() != WindowType::TOOLBOX;
 
 // the new parent for popup mode
 VclPtr pWin;
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 57c5f7ec26a8..87e622685fb7 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -427,7 +427,7 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow,
 aPos = pW->AbsoluteScreenToOutputPixel( aPos );
 
 // store a cliprect that can be used to clip the common edge of the 
itemrect and the floating window
-if( pFloatingWindow )
+if( pFloatingWindow && pFloatingWindow->mpImplData->mpBox )
 {
 pFloatingWindow->mpImplData->maItemEdgeClipRect =
 tools::Rectangle( e1, e2 );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-01-23 Thread Maxim Monastirsky
 vcl/source/control/ctrl.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 4e00b175e2c222bc320ec16caa90aa1bd2c1b7a7
Author: Maxim Monastirsky 
Date:   Sat Jan 20 19:51:34 2018 +0200

tdf#115023 Check mpControlData for nullptr

Control::ImplClearLayoutData happens to be called post
dispose, but Control::dispose already destroyed
mpControlData. So put back the nullptr check that was
removed in e8b49f09074fe184374bee5062715357427ae044
("new loplugin: useuniqueptr: vcl").

(But IMHO it's odd that we even try to send lose focus
events to disposing windows. So maybe it would make sense
to replace the "! pOldFocusWindow->IsDisposed()" check
inside Window::ImplGrabFocus with "isDisposed()" which
comes from VclReferenceBase, and set much earlier?)

Change-Id: Iddaf7e05d6cb56c28a34884876770753fcf7179e
Reviewed-on: https://gerrit.libreoffice.org/48246
Reviewed-by: Noel Grandin 
Tested-by: Jenkins 
Reviewed-by: Maxim Monastirsky 
(cherry picked from commit 2a2b37202a735b34da914c03b2f6e1495f833b51)
Reviewed-on: https://gerrit.libreoffice.org/48251
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index b62c90563d46..5f3d23901b0a 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -328,7 +328,8 @@ void Control::SetLayoutDataParent( const Control* pParent ) 
const
 
 void Control::ImplClearLayoutData() const
 {
-mpControlData->mpLayoutData.reset();
+if (mpControlData)
+mpControlData->mpLayoutData.reset();
 }
 
 void Control::ImplDrawFrame( OutputDevice* pDev, tools::Rectangle& rRect )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source xmlsecurity/qa

2018-01-23 Thread Miklos Vajna
 vcl/source/filter/ipdf/pdfdocument.cxx|9 +
 xmlsecurity/qa/unit/pdfsigning/data/tdf114460.pdf |binary
 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx |2 ++
 3 files changed, 11 insertions(+)

New commits:
commit e45ca13634ba51a6133a231f74db76be06bb4d95
Author: Miklos Vajna 
Date:   Mon Jan 22 22:12:04 2018 +0100

tdf#114460 vcl: handle nested parentheses in PDF roundtrip

The roundtrip of the pdf image failed due to this.

(cherry picked from commit f58a16d5987c8e8c16580c514ce0c7b0895b4105)

Change-Id: I88a9657e242dd2659f9bf06233e5fcbfeb43ceb5
Reviewed-on: https://gerrit.libreoffice.org/48378
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx 
b/vcl/source/filter/ipdf/pdfdocument.cxx
index 56e90cf7adf3..11c4519e44cf 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -2021,11 +2021,20 @@ bool PDFLiteralStringElement::Read(SvStream& rStream)
 nPrevCh = ch;
 rStream.ReadChar(ch);
 
+// Start with 1 nesting level as we read a '(' above already.
+int nDepth = 1;
 OStringBuffer aBuf;
 while (!rStream.eof())
 {
+if (ch == '(' && nPrevCh != '\\')
+++nDepth;
+
 if (ch == ')' && nPrevCh != '\\')
+--nDepth;
+
+if (nDepth == 0)
 {
+// ')' of the outermost '(' is reached.
 m_aValue = aBuf.makeStringAndClear();
 SAL_INFO("vcl.filter", "PDFLiteralStringElement::Read: m_aValue is 
'" << m_aValue << "'");
 return true;
diff --git a/xmlsecurity/qa/unit/pdfsigning/data/tdf114460.pdf 
b/xmlsecurity/qa/unit/pdfsigning/data/tdf114460.pdf
new file mode 100644
index ..a736e5bb90cd
Binary files /dev/null and b/xmlsecurity/qa/unit/pdfsigning/data/tdf114460.pdf 
differ
diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx 
b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index 642a034ae5e1..c989af96f1b3 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -448,6 +448,8 @@ void PDFSigningTest::testTokenize()
 // File that's intentionally smaller than 1024 bytes.
 "small.pdf",
 "tdf107149.pdf",
+// Nested parentheses were not handled.
+"tdf114460.pdf",
 };
 
 for (const auto& rName : aNames)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-01-23 Thread Caolán McNamara
 vcl/source/gdi/pdfwriter_impl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 905edcb273c629a149e7bcd212376e2c962a1c0b
Author: Caolán McNamara 
Date:   Mon Jan 22 17:37:33 2018 +

its defineresource not define resource

regression from

commit 64d624b65124ac02d8ee59b135593fd9d8eb9067
Date:   Sat Jan 9 22:55:28 2016 +0100

Fix typos

Change-Id: I9a5940027423ff0791fa7da0b79b617412ce6b86
Reviewed-on: https://gerrit.libreoffice.org/21209
Tested-by: Jenkins 

Change-Id: Ifdf45e97b81523c84c73b93d14ed75b7b6909f77
Reviewed-on: https://gerrit.libreoffice.org/48356
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 34161b7ca35a..03b1a1d9e12d 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3082,7 +3082,7 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8 
const * pEncoding,
 }
 aContents.append( "endbfchar\n"
   "endcmap\n"
-  "CMapName currentdict /CMap define resource pop\n"
+  "CMapName currentdict /CMap defineresource pop\n"
   "end\n"
   "end\n" );
 SvMemoryStream aStream;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-01-11 Thread Samuel Mehrbrodt
 vcl/source/window/accessibility.cxx |4 +++-
 vcl/source/window/window.cxx|3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 10eb616c3106b538857542f1c4b1df375a6cf1b6
Author: Samuel Mehrbrodt 
Date:   Wed Jan 10 13:25:33 2018 +0100

tdf#113874 Guard against invalid states

Change-Id: I013dd4eb81f0fbef25d9f58e27fe72d800d910ba
Reviewed-on: https://gerrit.libreoffice.org/47702
Tested-by: Jenkins 
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit d2763bde00f0f840585e1ec4c8f94c0ef804a580)
Reviewed-on: https://gerrit.libreoffice.org/47744
Reviewed-by: Thorsten Behrens 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/window/accessibility.cxx 
b/vcl/source/window/accessibility.cxx
index 3d81a1e82edc..4ee4b07ea89d 100644
--- a/vcl/source/window/accessibility.cxx
+++ b/vcl/source/window/accessibility.cxx
@@ -139,7 +139,9 @@ css::uno::Reference< css::accessibility::XAccessible > 
Window::CreateAccessible(
 
 void Window::SetAccessible( const css::uno::Reference< 
css::accessibility::XAccessible >& x )
 {
-assert(mpWindowImpl);
+if (!mpWindowImpl)
+return;
+
 mpWindowImpl->mxAccessible = x;
 }
 
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 84dabd027689..a3310a5b4976 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3136,7 +3136,8 @@ const OUString& Window::GetHelpText() const
 
 void Window::SetWindowPeer( Reference< css::awt::XWindowPeer > const & xPeer, 
VCLXWindow* pVCLXWindow  )
 {
-assert(mpWindowImpl);
+if (!mpWindowImpl)
+return;
 
 // be safe against re-entrance: first clear the old ref, then assign the 
new one
 mpWindowImpl->mxWindowPeer.clear();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2018-01-09 Thread Caolán McNamara
 vcl/source/fontsubset/cff.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4e96c457f08368843d32337a9a2d9ccefa62839e
Author: Caolán McNamara 
Date:   Mon Jan 8 16:42:46 2018 +

tdf#114704 use of float as intermediate causes out by one on large offsets

table offset integer value of 21281769 is correctly read, but on cast to 
float
it is represented as 21281768 and we're off by one when cast back to integer
later

Change-Id: I5694e14d72c04493ba15cc77485a734498a45468
Reviewed-on: https://gerrit.libreoffice.org/47608
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index 00b6492ad34c..284242882274 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -31,7 +31,7 @@ typedef long long S64;
 
 typedef sal_Int32 GlyphWidth;
 
-typedef float RealType;
+typedef double RealType;
 typedef RealType ValType;
 #include 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2017-12-19 Thread Stephan Bergmann
 vcl/source/app/salusereventlist.cxx |   22 --
 vcl/source/app/scheduler.cxx|   25 +
 2 files changed, 41 insertions(+), 6 deletions(-)

New commits:
commit 3262b70bbabef8e899c50e7831ac2ef68dcc7d6c
Author: Stephan Bergmann 
Date:   Thu Dec 14 14:14:24 2017 +0100

Report more debug information about caught exception

...in an attempt to track down why various tinderbox builds started to fail
CppunitTest_sw_filters_test with an "Uncaught exception during 
Task::Invoke()!"
abort.

On IRC, jmux claims that catching exceptions and turning them into abort() 
here
(instead of letting them propagate) is necessary:  "The main problem was the
wrong state in the scheduler.  So something actually handled the exception, 
but
the next caller into the scheduler had an invalid linked list of tasks, 
breaking
things left and right."

Change-Id: Ic3365e282404483518652c00160c2036b79991cf
Reviewed-on: https://gerrit.libreoffice.org/46450
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 
(cherry picked from commit ba81ac19b7aec4fd7f07fcec9f6ea6f85d9aaa24)
Reviewed-on: https://gerrit.libreoffice.org/46532
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/app/salusereventlist.cxx 
b/vcl/source/app/salusereventlist.cxx
index a3b77ecc2c19..50ef1f892002 100644
--- a/vcl/source/app/salusereventlist.cxx
+++ b/vcl/source/app/salusereventlist.cxx
@@ -21,7 +21,14 @@
 #include 
 
 #include 
-
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
 #include 
 
 SalUserEventList::SalUserEventList()
@@ -90,9 +97,20 @@ bool SalUserEventList::DispatchUserEvents( bool 
bHandleAllCurrentEvents )
 {
 ProcessEvent( aEvent );
 }
+catch (css::uno::Exception& e)
+{
+auto const e2 = cppu::getCaughtException();
+SAL_WARN("vcl", "Uncaught " << e2.getValueTypeName() << " " << 
e.Message);
+std::abort();
+}
+catch (std::exception& e)
+{
+SAL_WARN("vcl", "Uncaught " << typeid(e).name() << " " << 
e.what());
+std::abort();
+}
 catch (...)
 {
-SAL_WARN( "vcl", "Uncaught exception during ProcessEvent!" );
+SAL_WARN("vcl", "Uncaught exception during 
DispatchUserEvents!");
 std::abort();
 }
 }
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 2ef3c87d83f8..b53a58ecf555 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -20,7 +20,14 @@
 #include 
 
 #include 
-
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -439,11 +446,21 @@ next_entry:
 {
 pTask->Invoke();
 }
+catch (css::uno::Exception& e)
+{
+auto const e2 = cppu::getCaughtException();
+SAL_WARN("vcl.schedule", "Uncaught " << e2.getValueTypeName() << " 
" << e.Message);
+std::abort();
+}
+catch (std::exception& e)
+{
+SAL_WARN("vcl.schedule", "Uncaught " << typeid(e).name() << " " << 
e.what());
+std::abort();
+}
 catch (...)
 {
-SAL_WARN( "vcl.schedule",
-  "Uncaught exception during Task::Invoke()!" );
-abort();
+SAL_WARN("vcl.schedule", "Uncaught exception during 
Task::Invoke()!");
+std::abort();
 }
 Lock( nLockCount );
 pMostUrgent->mbInScheduler = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2017-12-18 Thread Caolán McNamara
 vcl/source/gdi/jobset.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 80785f935455f3e740c57febc33410f1ee81f12a
Author: Caolán McNamara 
Date:   Sun Dec 17 13:57:46 2017 +

ofz: ensure null termination

Change-Id: I6b6b0763e85a41d03f9e03c6abc17c6c311f6519
Reviewed-on: https://gerrit.libreoffice.org/46642
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index cc8712a48615..fe7cbb2936d9 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -256,7 +256,9 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& 
rJobSetup )
 
 ImplJobSetup& rJobData = rJobSetup.ImplGetData();
 
+pData->cPrinterName[SAL_N_ELEMENTS(pData->cPrinterName) - 1] = 0;
 rJobData.SetPrinterName( OStringToOUString(pData->cPrinterName, 
aStreamEncoding) );
+pData->cDriverName[SAL_N_ELEMENTS(pData->cDriverName) - 1] = 0;
 rJobData.SetDriver( OStringToOUString(pData->cDriverName, 
aStreamEncoding) );
 
 // Are these our new JobSetup files?
@@ -345,9 +347,9 @@ SvStream& WriteJobSetup( SvStream& rOStream, const 
JobSetup& rJobSetup )
 ImplOldJobSetupData aOldData;
 memset( , 0, sizeof( aOldData ) );
 OString aPrnByteName(OUStringToOString(rJobData.GetPrinterName(), 
RTL_TEXTENCODING_UTF8));
-strncpy( aOldData.cPrinterName, aPrnByteName.getStr(), 63 );
+strncpy(aOldData.cPrinterName, aPrnByteName.getStr(), 
SAL_N_ELEMENTS(aOldData.cPrinterName) - 1);
 OString aDriverByteName(OUStringToOString(rJobData.GetDriver(), 
RTL_TEXTENCODING_UTF8));
-strncpy( aOldData.cDriverName, aDriverByteName.getStr(), 31 );
+strncpy(aOldData.cDriverName, aDriverByteName.getStr(), 
SAL_N_ELEMENTS(aOldData.cDriverName) - 1);
 int nPos = rOStream.Tell();
 rOStream.WriteUInt16( 0 );
 rOStream.WriteUInt16( JOBSET_FILE605_SYSTEM );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2017-12-18 Thread Maxim Monastirsky
 vcl/source/window/toolbox.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit e067187427cf5f53ee1c2176f1042b4fedb67783
Author: Maxim Monastirsky 
Date:   Wed Dec 6 01:20:13 2017 +0200

tdf#114262 Respect text+image toolbar style

Regression of 67c9d054517fc3b5cbc203c330eedef4b50f0e57
("fdo#84938: replace TIB_ constants with enum").

Change-Id: Ib90473a80fd491f4a136b4e76864c107a9240990
Reviewed-on: https://gerrit.libreoffice.org/45920
Tested-by: Jenkins 
Reviewed-by: Maxim Monastirsky 
(cherry picked from commit 291ea673180a37912697646850959b3f6553cc7a)
Reviewed-on: https://gerrit.libreoffice.org/46144
Reviewed-by: Katarina Behrens 

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index c7b98962689b..0eb843cf167c 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -148,12 +148,13 @@ int ToolBox::ImplGetDragWidth() const
 ButtonType determineButtonType( ImplToolItem const * pItem, ButtonType 
defaultType )
 {
 ButtonType tmpButtonType = defaultType;
-if ( pItem->mnBits & (ToolBoxItemBits::TEXT_ONLY | 
ToolBoxItemBits::ICON_ONLY) ) // item has custom setting
+ToolBoxItemBits nBits = pItem->mnBits & ( ToolBoxItemBits::TEXT_ONLY | 
ToolBoxItemBits::ICON_ONLY );
+if ( nBits != ToolBoxItemBits::NONE ) // item has custom setting
 {
 tmpButtonType = ButtonType::SYMBOLTEXT;
-if ( pItem->mnBits & ToolBoxItemBits::TEXT_ONLY )
+if ( nBits == ToolBoxItemBits::TEXT_ONLY )
 tmpButtonType = ButtonType::TEXT;
-else if ( pItem->mnBits & ToolBoxItemBits::ICON_ONLY )
+else if ( nBits == ToolBoxItemBits::ICON_ONLY )
 tmpButtonType = ButtonType::SYMBOLONLY;
 }
 return tmpButtonType;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2017-12-15 Thread Caolán McNamara
 vcl/source/window/window.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0b100b78ccb24a4f8da51433f535030facb77705
Author: Caolán McNamara 
Date:   Tue Dec 12 14:17:11 2017 +

tdf#114408 set correct tooltip rectangle

The original code tried to get the position of the window relative
to its parent and then ask the parent to adjust that position to
a position relative to the toplevel. But the position to use in
that case should have be WindowImpl::nX/WindowImpl::nY not GetPosPixel()

Much easier to just directly ask the the current window for its position
relative to the toplevel.

Change-Id: Iff202f052bc651a8c0e3a57ff3322e5e2a3e4b9a
Reviewed-on: https://gerrit.libreoffice.org/46315
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 5083f418b2c2..84dabd027689 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1861,7 +1861,7 @@ void Window::RequestHelp( const HelpEvent& rHEvt )
 {
 Point aPos = GetPosPixel();
 if ( ImplGetParent() && !ImplIsOverlapWindow() )
-aPos = ImplGetParent()->OutputToScreenPixel( aPos );
+aPos = OutputToScreenPixel(Point(0, 0));
 tools::Rectangle   aRect( aPos, GetSizePixel() );
 
 Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aRect, rStr );
@@ -1876,7 +1876,7 @@ void Window::RequestHelp( const HelpEvent& rHEvt )
 {
 Point aPos = GetPosPixel();
 if ( ImplGetParent() && !ImplIsOverlapWindow() )
-aPos = ImplGetParent()->OutputToScreenPixel( aPos );
+aPos = OutputToScreenPixel(Point(0, 0));
 tools::Rectangle   aRect( aPos, GetSizePixel() );
 OUString  aHelpText;
 if ( !rStr.isEmpty() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source

2017-12-02 Thread Michael Stahl
 vcl/source/window/dialog.cxx |   14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

New commits:
commit eeab393fe392dd558beadb89ed7b1b541481b732
Author: Michael Stahl 
Date:   Wed Nov 29 15:24:50 2017 +0100

Revert "tdf#114025 - avoid deadlock between x11 clipboard and ...

... the lock dialog."

SolarMutexReleaser hack can be avoided with the rtl_Instance fix
from commit fa9c083c6071a0a4dc812f3c34731f347ddbabf7.

This reverts commit b0e37303df56472fdc7782b977326c2391fdab07.

Change-Id: Ib90cdec1420807afbadfd526a1ddb68d58db79c1
Reviewed-on: https://gerrit.libreoffice.org/45624
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit a246dc116a534cacef34c0e376a54391341b36e8)
Reviewed-on: https://gerrit.libreoffice.org/45655
Tested-by: Michael Stahl 

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index a55dc52705a4..4db7c9674a83 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1063,15 +1063,13 @@ short Dialog::Execute()
 return 0;
 
 VclPtr xWindow = this;
-{
-SolarMutexReleaser aReleaser; // tdf#114025
-css::uno::Reference< css::uno::XComponentContext > xContext(
+
+css::uno::Reference< css::uno::XComponentContext > xContext(
 comphelper::getProcessComponentContext() );
-css::uno::Reference 
xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), 
css::uno::UNO_QUERY_THROW);
-css::document::DocumentEvent aObject;
-aObject.EventName = "DialogExecute";
-xEventBroadcaster->documentEventOccured(aObject);
-}
+css::uno::Reference 
xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), 
css::uno::UNO_QUERY_THROW);
+css::document::DocumentEvent aObject;
+aObject.EventName = "DialogExecute";
+xEventBroadcaster->documentEventOccured(aObject);
 UITestLogger::getInstance().log("DialogExecute");
 // Yield util EndDialog is called or dialog gets destroyed
 // (the latter should not happen, but better safe than sorry
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits