summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2018-06-18 16:48:02 +0200
committerCaolán McNamara <caolanm@redhat.com>2018-06-25 15:40:25 +0200
commitc959815d55919967c9697dc8862ddec6844b7796 (patch)
tree0fb07fb00bcec31a64b917708782b2c1cc32fc9c /vcl
parente0287fcde646c1f6377f3ae9babe7b5155780282 (diff)
tdf#103913 keep ".emf" file extension and mime type
in documents, don't change them to wmf and image/x-wmf silently, resulting for example, dropping or rejecting modified documents by firewall packet filtering. Reviewed-on: https://gerrit.libreoffice.org/56045 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org> Conflicts: svx/source/xml/xmlgrhlp.cxx (cherry-pick from commit 4cb1e86e5217f09e1d98e51e46803a06fb72f5ce) Change-Id: I3b8634ae022c7c026b0ed4ebc345c1c3b3f96337 Reviewed-on: https://gerrit.libreoffice.org/56084 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org> Tested-by: Jenkins Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/gfxlink.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx
index a7a33ad1c862..c1acb0a60957 100644
--- a/vcl/source/gdi/gfxlink.cxx
+++ b/vcl/source/gdi/gfxlink.cxx
@@ -277,4 +277,20 @@ std::shared_ptr<sal_uInt8> GfxLink::GetSwapInData() const
return pData;
}
+bool GfxLink::IsEMF() const
+{
+ const sal_uInt8* pGraphicAry = GetData();
+ if ((GetType() == GfxLinkType::NativeWmf) && pGraphicAry && (GetDataSize() > 0x2c))
+ {
+ // check the magic number
+ if ((pGraphicAry[0x28] == 0x20) && (pGraphicAry[0x29] == 0x45)
+ && (pGraphicAry[0x2a] == 0x4d) && (pGraphicAry[0x2b] == 0x46))
+ {
+ //emf detected
+ return true;
+ }
+ }
+ return false;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */