diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-09-26 10:38:19 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-09-26 10:38:19 +0200 |
commit | 01dea3321c23c7a83134f25a1ea62a6d3e8cddf4 (patch) | |
tree | 74b799a28d71075a1befd0c4b7635f84d540d0d2 | |
parent | 302843bb6dc2c82de37015b6d444b1d7cbf33c1e (diff) |
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
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchvalue.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
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; |