summaryrefslogtreecommitdiff
path: root/i18npool/inc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-04-12 22:15:04 +0200
committerStephan Bergmann <sbergman@redhat.com>2023-04-13 08:23:59 +0200
commit852af3af0dde3810e323afc3d42d7bd1cd4e67bc (patch)
treeb63286521161b11953b1b04e3f60f3f73f0d250d /i18npool/inc
parentcbdd54e41a78e6a567d7ff97935721b07461cce5 (diff)
Fix UBSan function-type-mismatch
...as seen with the additions to CppunitTest_i18npool_transliteration made here, > i18npool/source/transliteration/textToPronounce_zh.cxx:175:17: runtime error: call to function get_zh_zhuyin through pointer to incorrect function type 'unsigned short **(*)()' > workdir/CustomTarget/i18npool/indexentry/zh_zhuyin.cxx:1512: note: get_zh_zhuyin defined here > #0 in i18npool::TextToPronounce_zh::TextToPronounce_zh(char const*) at i18npool/source/transliteration/textToPronounce_zh.cxx:175:17 > #1 in i18npool::TextToChuyin_zh_TW::TextToChuyin_zh_TW() at i18npool/source/transliteration/textToPronounce_zh.cxx:149:5 > #2 in TextToChuyin_zh_TW_CreateInstance(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const&) at i18npool/source/registerservices/registerservices.cxx:236:1 > #3 in cppu::(anonymous namespace)::OFactoryComponentHelper::createInstanceEveryTime(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) at cppuhelper/source/factory.cxx:173:24 > #4 in cppu::(anonymous namespace)::OFactoryComponentHelper::createInstanceWithContext(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) at cppuhelper/source/factory.cxx:230:12 > #5 in non-virtual thunk to cppu::(anonymous namespace)::OFactoryComponentHelper::createInstanceWithContext(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) at cppuhelper/source/factory.cxx > #6 in cppuhelper::ServiceManager::Data::Implementation::doCreateInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) at cppuhelper/source/servicemanager.cxx:709:26 > #7 in cppuhelper::ServiceManager::Data::Implementation::createInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, bool) at cppuhelper/source/servicemanager.cxx:675:16 > #8 in cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) at cppuhelper/source/servicemanager.cxx:1006:36 > #9 in non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) at cppuhelper/source/servicemanager.cxx > #10 in i18npool::TransliterationImpl::loadBody(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::i18n::XExtendedTransliteration>&) at i18npool/source/transliteration/transliterationImpl.cxx:619:45 > #11 in i18npool::TransliterationImpl::loadModuleByName(std::basic_string_view<char16_t, std::char_traits<char16_t>>, com::sun::star::uno::Reference<com::sun::star::i18n::XExtendedTransliteration>&, com::sun::star::lang::Locale const&) at i18npool/source/transliteration/transliterationImpl.cxx:630:5 > #12 in i18npool::TransliterationImpl::loadModuleByImplName(rtl::OUString const&, com::sun::star::lang::Locale const&) at i18npool/source/transliteration/transliterationImpl.cxx:278:9 > #13 in (anonymous namespace)::Transliteration::testTextToChuyin_zh_TW() at i18npool/qa/cppunit/transliteration.cxx:120:27 For one, there had always been a mismatch between the return type `const sal_uInt16**` generated in i18npool/source/indexentry/genindex_data.cxx since d319c4611e932b286c0bef14387382da0f2e92d2 "INTEGRATION: CWS i18n24 (1.1.2); FILE ADDED" vs. `sal_uInt16**` used in i18npool/source/transliteration/textToPronounce_zh.cxx since f4705bf0a3efeebfe74568abb355ad60621300dd "INTEGRATION: CWS i18n24 (1.8.36); FILE MERGED". And for another (and more severe, as it caused random writes), there had also been a mismatch between the parameters `(sal_Int16 &max_index)` newly generated in i18npool/source/indexentry/genindex_data.cxx since 7696cd3902ca248951205f15930787488368ea26 "INTEGRATION: CWS i18n31 (1.4.60); FILE MERGED" (and correctly used in i18npool/source/indexentry/indexentrysupplier_asian.cxx since 58dcf0ffaf8668827fc2f47445c9d8faf3d29555 "INTEGRATION: CWS i18n31 (1.9.60); FILE MERGED") vs. the original `()` used in i18npool/source/transliteration/textToPronounce_zh.cxx ever since f4705bf0a3efeebfe74568abb355ad60621300dd "INTEGRATION: CWS i18n24 (1.8.36); FILE MERGED". For DISABLE_DYNLOADING, the second (missing max_index parameter) issue appears to have been broken even further with 9db03b879b912d79060ab06f03a54d4a59e6ac65 "i18npool: fix wrong static function symbols", replacing the wrong sal_uInt16** get_zh_zhuyin(); sal_uInt16** get_zh_pinyin(); declarations in i18npool/source/transliteration/textToPronounce_zh.cxx with the even worse declarations sal_uInt16** get_collator_data_zh_zhuyin(); sal_uInt16** get_collator_data_zh_pinyin(); corresponding to function definitions generated by i18npool/source/collator/gencoll_rule.cxx (which also happen to have zero parameters, but non-matching return types, and apparently completely different collation vs. transliteration semantics). Change-Id: Id91b17eeb7fcdd0c711d52a624375356dc47fc32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150302 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'i18npool/inc')
-rw-r--r--i18npool/inc/textToPronounce_zh.hxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/i18npool/inc/textToPronounce_zh.hxx b/i18npool/inc/textToPronounce_zh.hxx
index 2ac854abddbd..b34398e608f8 100644
--- a/i18npool/inc/textToPronounce_zh.hxx
+++ b/i18npool/inc/textToPronounce_zh.hxx
@@ -30,14 +30,14 @@ protected:
#ifndef DISABLE_DYNLOADING
oslModule hModule;
#endif
- sal_uInt16 **idx;
+ sal_uInt16 const **idx;
const sal_Unicode* getPronounce(const sal_Unicode ch);
public:
#ifndef DISABLE_DYNLOADING
TextToPronounce_zh(const char* func_name);
#else
- TextToPronounce_zh(sal_uInt16 ** (*function)());
+ TextToPronounce_zh(sal_uInt16 const ** (*function)(sal_Int16 &));
#endif
virtual ~TextToPronounce_zh() override;