summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/qa/cppunit/graphicfilter/data/wmf/pass/exttextout-1.wmfbin0 -> 2142 bytes
-rw-r--r--vcl/source/filter/wmf/winwmf.cxx8
2 files changed, 8 insertions, 0 deletions
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 000000000000..365a247a7103
--- /dev/null
+++ b/vcl/qa/cppunit/graphicfilter/data/wmf/pass/exttextout-1.wmf
Binary files differ
diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index 810aa106ccd0..5ee86b972f9e 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