[Libreoffice-commits] core.git: vcl/qa vcl/source

Caolán McNamara caolanm at redhat.com
Fri Feb 24 11:39:56 UTC 2017


 vcl/qa/cppunit/graphicfilter/data/wmf/pass/exttextout-1.wmf |binary
 vcl/source/filter/wmf/winwmf.cxx                            |    8 ++++++++
 2 files changed, 8 insertions(+)

New commits:
commit b1a1bdec2d667225ae4c8137c447f9080bafbe5c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 24 11:36:45 2017 +0000

    ofz: slow unit
    
    Change-Id: I482a6c95810d03e47a5be18e6b45ee4db19f56e4

diff --git a/vcl/qa/cppunit/graphicfilter/data/wmf/pass/exttextout-1.wmf b/vcl/qa/cppunit/graphicfilter/data/wmf/pass/exttextout-1.wmf
new file mode 100644
index 0000000..365a247
Binary files /dev/null and b/vcl/qa/cppunit/graphicfilter/data/wmf/pass/exttextout-1.wmf differ
diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index 810aa10..5ee86b9 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -545,6 +545,14 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
                     const Point aPt2( ReadPoint() );
                     aRect = Rectangle( aPt1, aPt2 );
                 }
+
+                auto nRemainingSize = pWMF->remainingSize();
+                if (nRemainingSize < static_cast<sal_uInt32>(nOriginalBlockLen))
+                {
+                    SAL_WARN("vcl.wmf", "exttextout record claimed more data than the stream can provide");
+                    nOriginalTextLen = nOriginalBlockLen = nRemainingSize;
+                }
+
                 std::unique_ptr<char[]> pChar(new char[nOriginalBlockLen]);
                 pWMF->ReadBytes(pChar.get(), nOriginalBlockLen);
                 OUString aText(pChar.get(), nOriginalTextLen, pOut->GetCharSet()); // after this conversion the text may contain


More information about the Libreoffice-commits mailing list