summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-11-03 16:07:44 +0100
committerStephan Bergmann <sbergman@redhat.com>2023-11-03 17:26:58 +0100
commitcef555e9a43b2cf1f46763b768973f89c5c1b053 (patch)
tree756115987adea5e0369acdaa1a5ebb0215f04245 /avmedia
parent1e95b89f8f9910c9f4b3b918aa83cf2185d9c11b (diff)
Make ExternalReferenceUriTranslator more robust against broken UTF-8
<https://lists.freedesktop.org/archives/libreoffice/2023-November/091151.html> "CppunitTest_stoc_uriproc failed on Windows" reports that translateToExternal("file:///abc/%feef") produces an empty string (indicating failure) instead of "file:///abc/%FEef" (as expected in stoc/test/uriproc/test_uriproc.cxx) when osl_getThreadTextEncoding() is Shift JIS. This was due to how the call to rtl::Uri::encode in Translator::translateToExternal (in stoc/source/uriproc/ExternalUriReferenceTranslator.cxx) behaved: It internally interpreted its input "%FE" as the single-byte Shift JIS character 0xFE. Which gets mapped to U+2122 as an extension (see "APPLE additions over SJIS, we convert this like Apple, because I think, this gives better result, then [sic] we take a replacement char" in sal/textenc/tcvtjp6.tab) in readUcs4, but which in turn doesn't get mapped back to any Shift JIS character in writeEscapeChar. Translator::translateToExternal is the only user of rtl_UriEncodeStrictKeepEscapes, as introduced by 6ff5d3341dbc5df3f0cb5368ccb0e1089338916c "INTEGRATION: CWS c07v013_SRC680 (1.4.40); FILE MERGED: 2007/06/21 13:00:56 sb 1.4.40.1: #b6550116# Made XExternalUriReferenceTranslator.translateToExternal more robust when the input URL contains spurious non--UTF-8 octets like %FE (which are now copied verbatim, instead of signalling error)." To make the claim true that such "spurious non--UTF-8 octets like %FE" are always "copied verbatim", regardless of text encoding being used, repurpose rtl_UriEncodeStrictKeepEscapes to always treat any escape sequences that are present as (potentially broken) UTF-8. Change-Id: I0fa0b14d3e3d44e4b5514e1b73c84c407a947ce9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158888 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'avmedia')
0 files changed, 0 insertions, 0 deletions