[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - sw/qa sw/source ucb/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 18 11:58:36 UTC 2019
sw/qa/extras/ooxmlexport/data/tdf116371.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 10 +++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 37 ++++++++++++++++-----------
ucb/source/ucp/webdav-neon/NeonSession.cxx | 14 ++++++++--
ucb/source/ucp/webdav-neon/NeonSession.hxx | 1
ucb/source/ucp/webdav-neon/webdavcontent.cxx | 10 ++-----
6 files changed, 50 insertions(+), 22 deletions(-)
New commits:
commit 0ba1cb36688baff5814ae61163d401f2ecb39e31
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Jan 8 05:47:04 2019 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue Jun 18 13:57:52 2019 +0200
Don't crash when accessing WebDAV resource after auth failed
In my testing on Windows, the crashing scenario was this:
1. FileDialogHelper_Impl::updateVersions() creates storage calling
comphelper::OStorageHelper::GetStorageFromURL;
2. Content::openStream() calls isDocument first;
3. Content::isDocument() indirectly initiates WebDAV session,
creating a NeonSession;
4. All operations of NeonSession call Init() first; its first call
initializes m_pHttpSession using ne_session_create, and then
adds auth callbacks using ne_add_server_auth/ne_add_proxy_auth
5. Then NeonSession performs the rest of PROPFIND task, calling
ah_post_send and auth_challenge; the latter fails, then
ah_post_send calls clean_session, which cleans m_pHttpSession's
auth_session's sspi_host;
6. NeonSession::HandleError throws DAVException for NE_AUTH error;
7. Content::isDocument() returns true to Content::openStream(),
which proceeds to execute the command, which in turn re-uses
the NeonSession and its m_pHttpSession;
8. NeonSession::OPTIONS then indirectly calls continue_sspi, which
tries to dereference the m_pHttpSession's auth_session's
sspi_host which is nullptr at this point.
So in case NeonSession detects the NE_AUTH error condition, let's
set a flag indicating that the next Init() should reinitialize its
m_pHttpSession.
Also fixed a case when xProps was used before initialization in
Content::getPropertyValues.
Change-Id: Ifc9eec4fe0333ff6be17c5089068441b4a6eb78c
Reviewed-on: https://gerrit.libreoffice.org/65950
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
(cherry picked from commit 162a472d55cf9fb9aaa6d5eae625b3da2273a516)
Reviewed-on: https://gerrit.libreoffice.org/74261
Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index c10796a48e79..164d30e56ae3 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -671,7 +671,8 @@ void NeonSession::Init()
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- bool bCreateNewSession = false;
+ bool bCreateNewSession = m_bNeedNewSession;
+ m_bNeedNewSession = false;
if ( m_pHttpSession == nullptr )
{
@@ -725,13 +726,17 @@ void NeonSession::Init()
m_aProxyName = rProxyCfg.aName;
m_nProxyPort = rProxyCfg.nPort;
+ bCreateNewSession = true;
+ }
+
+ if (bCreateNewSession)
+ {
// new session needed, destroy old first
{
osl::Guard< osl::Mutex > theGlobalGuard(getGlobalNeonMutex());
ne_session_destroy( m_pHttpSession );
}
m_pHttpSession = nullptr;
- bCreateNewSession = true;
}
}
@@ -1966,6 +1971,11 @@ void NeonSession::HandleError( int nError,
m_aHostName, m_nPort ) );
case NE_AUTH: // User authentication failed on server
+ // m_pHttpSession could get invalidated, e.g., as result of clean_session called in
+ // ah_post_send in case when auth_challenge failed, which invalidates the auth_session
+ // which we established in Init(): the auth_session's sspi_host gets disposed, and
+ // next attempt to authenticate would crash in continue_sspi trying to dereference it
+ m_bNeedNewSession = true;
throw DAVException( DAVException::DAV_HTTP_AUTH,
NeonUri::makeConnectionEndPointString(
m_aHostName, m_nPort ) );
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.hxx b/ucb/source/ucp/webdav-neon/NeonSession.hxx
index 2adebaacd3fd..df4522da6e18 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.hxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.hxx
@@ -54,6 +54,7 @@ private:
sal_Int32 m_nProxyPort;
css::uno::Sequence< css::beans::NamedValue > const m_aFlags;
HttpSession * m_pHttpSession;
+ bool m_bNeedNewSession = false; // Something happened that could invalidate m_pHttpSession
void * const m_pRequestData;
const ucbhelper::InternetProxyDecider & m_rProxyDecider;
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 4616957b0725..6bec3d3e9300 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -1586,12 +1586,10 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
if ( eType == DAV )
{
- //xProps.reset(
- // new ContentProperties( aUnescapedTitle ) );
- xProps->addProperty(
- "Title",
- uno::makeAny( aUnescapedTitle ),
- true );
+ if (!xProps)
+ xProps.reset(new ContentProperties(aUnescapedTitle));
+ else
+ xProps->addProperty("Title", uno::makeAny(aUnescapedTitle), true);
}
else
{
commit 6ec61d46f1cbd60d5911a72070cabc6bc63add50
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Jan 26 17:13:28 2019 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue Jun 18 13:57:43 2019 +0200
tdf#116371: export rotation of SwGrfNode
Change-Id: I42620da798a35dfada67d9a9fb23d554cc20b16f
Reviewed-on: https://gerrit.libreoffice.org/66963
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
(cherry picked from commit b226383a83e41bbced9fc2a02dc09a449401ec97)
Reviewed-on: https://gerrit.libreoffice.org/74262
Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf116371.odt b/sw/qa/extras/ooxmlexport/data/tdf116371.odt
new file mode 100644
index 000000000000..257696616e8c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116371.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index d9f1978705cf..8b3665b3c81f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -119,6 +119,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf125324, "tdf125324.docx")
assertXPath(pXmlDoc, "/root/page/body/txt[2]/anchored/fly/tab/infos/bounds", "top", "4193");
}
+DECLARE_OOXMLEXPORT_TEST(testTdf116371, "tdf116371.odt")
+{
+ // Make sure the rotation is exported correctly, and size not distorted
+ auto xShape(getShape(1));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4700.0, getProperty<double>(xShape, "RotateAngle"), 10);
+ auto frameRect = getProperty<awt::Rectangle>(xShape, "FrameRect");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(24070), frameRect.Height);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(24188), frameRect.Width);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0438a1e54caf..02745ac0654a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4889,7 +4889,27 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
CharGrabBag(*pGrabBag);
}
- m_rExport.SdrExporter().startDMLAnchorInline(pFrameFormat, rSize);
+ rtl::Reference<sax_fastparser::FastAttributeList> xFrameAttributes(
+ FastSerializerHelper::createAttrList());
+ Size aSize = rSize;
+ if (pGrfNode)
+ {
+ const SwAttrSet& rSet = pGrfNode->GetSwAttrSet();
+ MirrorGraph eMirror = rSet.Get(RES_GRFATR_MIRRORGRF).GetValue();
+ if (eMirror == MirrorGraph::Vertical || eMirror == MirrorGraph::Both)
+ // Mirror on the vertical axis is a horizontal flip.
+ xFrameAttributes->add(XML_flipH, "1");
+ // RES_GRFATR_ROTATION is sal_uInt16; use sal_uInt32 for multiplication later
+ if (sal_uInt32 nRot = rSet.Get(RES_GRFATR_ROTATION).GetValue())
+ {
+ // RES_GRFATR_ROTATION is in 10ths of degree; convert to 100ths for macro
+ sal_uInt32 mOOXMLRot = OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRot*10);
+ xFrameAttributes->add(XML_rot, OString::number(mOOXMLRot));
+ aSize = pGrfNode->GetTwipSize();
+ }
+ }
+
+ m_rExport.SdrExporter().startDMLAnchorInline(pFrameFormat, aSize);
// picture description (used for pic:cNvPr later too)
::sax_fastparser::FastAttributeList* docPrattrList = FastSerializerHelper::createAttrList();
@@ -4996,25 +5016,14 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
XML_bwMode, "auto",
FSEND );
- rtl::Reference<sax_fastparser::FastAttributeList> xFrameAttributes(
- FastSerializerHelper::createAttrList());
-
- if (pGrfNode)
- {
- MirrorGraph eMirror = pGrfNode->GetSwAttrSet().Get(RES_GRFATR_MIRRORGRF).GetValue();
- if (eMirror == MirrorGraph::Vertical || eMirror == MirrorGraph::Both)
- // Mirror on the vertical axis is a horizontal flip.
- xFrameAttributes->add(XML_flipH, "1");
- }
-
m_pSerializer->startElementNS(
XML_a, XML_xfrm, uno::Reference<xml::sax::XFastAttributeList>(xFrameAttributes.get()));
m_pSerializer->singleElementNS( XML_a, XML_off,
XML_x, "0", XML_y, "0",
FSEND );
- OString aWidth( OString::number( TwipsToEMU( rSize.Width() ) ) );
- OString aHeight( OString::number( TwipsToEMU( rSize.Height() ) ) );
+ OString aWidth( OString::number( TwipsToEMU( aSize.Width() ) ) );
+ OString aHeight( OString::number( TwipsToEMU( aSize.Height() ) ) );
m_pSerializer->singleElementNS( XML_a, XML_ext,
XML_cx, aWidth.getStr(),
XML_cy, aHeight.getStr(),
More information about the Libreoffice-commits
mailing list