[Libreoffice-commits] core.git: writerfilter/source
Stephan Bergmann
sbergman at redhat.com
Tue Sep 26 08:42:36 UTC 2017
writerfilter/source/rtftok/rtfdispatchvalue.cxx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit 01dea3321c23c7a83134f25a1ea62a6d3e8cddf4
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Sep 26 10:38:19 2017 +0200
Map RTF codepage 0 to osl_getThreadTextEncoding()
...instead of RTL_TEXTENCODING_DONTKNOW. (A file actually using that codepage
is sw/qa/core/data/rtf/pass/CVE-2014-6357.rtf, processed by
CppunitTest/sw_filters_test, where it caused OStringToOUString to be called with
RTL_TEXTENCODING_DONTKNOW from
writerfilter::rtftok::RTFDocumentImpl::resolveChars.)
Change-Id: I41081c5df5c3aa80b4f1c7d52b158e73ef68cf38
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index f6a243e2fbc0..bebaee85107e 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -13,6 +13,7 @@
#include <comphelper/sequence.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <osl/thread.h>
#include <rtl/tencinfo.h>
#include <tools/colordata.hxx>
#include <tools/mapunit.hxx>
@@ -386,7 +387,9 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
// not found
return RTFError::OK;
- m_nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(aRTFEncodings[i].codepage);
+ m_nCurrentEncoding = aRTFEncodings[i].codepage == 0 // Default (CP_ACP)
+ ? osl_getThreadTextEncoding()
+ : rtl_getTextEncodingFromWindowsCodePage(aRTFEncodings[i].codepage);
m_aStates.top().nCurrentEncoding = m_nCurrentEncoding;
}
break;
More information about the Libreoffice-commits
mailing list