diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-09-12 14:29:21 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-09-12 21:21:19 +0200 |
commit | fb07dcf993bd3ff7880b26414e4095560c296d8b (patch) | |
tree | e54ce29fa9602d604905d329b2176dcceedd38f5 /vcl | |
parent | 798de29936b9a0c618bd31629936a4c836429e90 (diff) |
tdf#149545: increase svg check size
otherwise it will fail to open documents like the one in
tdf#149545 with long comments before "<svg"
Change-Id: Ia46dad92052ae4ef7fee791098bf96df03257282
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156844
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qa/cppunit/GraphicTest.cxx | 12 | ||||
-rw-r--r-- | vcl/qa/cppunit/data/tdf149545.svg | 32 | ||||
-rw-r--r-- | vcl/source/filter/GraphicFormatDetector.cxx | 2 |
3 files changed, 45 insertions, 1 deletions
diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx index 606936c65f9e..ef9678e42197 100644 --- a/vcl/qa/cppunit/GraphicTest.cxx +++ b/vcl/qa/cppunit/GraphicTest.cxx @@ -1294,6 +1294,18 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testTdf156016) CPPUNIT_ASSERT_EQUAL(tools::Long(100 * scalingY), aGraphic.GetSizePixel().Height()); } +CPPUNIT_TEST_FIXTURE(GraphicTest, testTdf149545) +{ + // Without the fix in place, this test would have failed with + // - Expected: 0x0(Error Area:Io Class:NONE Code:0) + // - Actual : 0x8203(Error Area:Vcl Class:General Code:3) + Graphic aGraphic = loadGraphic(u"tdf149545.svg"); + CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aGraphic.GetType()); + const auto[scalingX, scalingY] = getDPIScaling(); + CPPUNIT_ASSERT_EQUAL(tools::Long(100 * scalingX), aGraphic.GetSizePixel().Width()); + CPPUNIT_ASSERT_EQUAL(tools::Long(100 * scalingY), aGraphic.GetSizePixel().Height()); +} + CPPUNIT_TEST_FIXTURE(GraphicTest, testAvailableThreaded) { Graphic jpgGraphic1 = importUnloadedGraphic(u"TypeDetectionExample.jpg"); diff --git a/vcl/qa/cppunit/data/tdf149545.svg b/vcl/qa/cppunit/data/tdf149545.svg new file mode 100644 index 000000000000..39fd956142bd --- /dev/null +++ b/vcl/qa/cppunit/data/tdf149545.svg @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<!--======================================================================--> +<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 99 99"> +<rect x="0" y="0" width="99" height="99" fill="#000000"/> +</svg> + + diff --git a/vcl/source/filter/GraphicFormatDetector.cxx b/vcl/source/filter/GraphicFormatDetector.cxx index 2cf9e953003e..38a6ec28585e 100644 --- a/vcl/source/filter/GraphicFormatDetector.cxx +++ b/vcl/source/filter/GraphicFormatDetector.cxx @@ -32,7 +32,7 @@ #include <vcl/outdev.hxx> #include <utility> -constexpr sal_uInt32 SVG_CHECK_SIZE = 2048; +constexpr sal_uInt32 SVG_CHECK_SIZE = 8192; constexpr sal_uInt32 WMF_EMF_CHECK_SIZE = 44; namespace |