office-gobmx/i18npool/CppunitTest_i18npool_transliteration.mk
Stephan Bergmann 852af3af0d 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::uno::Reference<com::sun::lang::XMultiServiceFactory> const&) at i18npool/source/registerservices/registerservices.cxx:236:1
>  #3 in cppu::(anonymous namespace)::OFactoryComponentHelper::createInstanceEveryTime(com::sun::uno::Reference<com::sun::uno::XComponentContext> const&) at cppuhelper/source/factory.cxx:173:24
>  #4 in cppu::(anonymous namespace)::OFactoryComponentHelper::createInstanceWithContext(com::sun::uno::Reference<com::sun::uno::XComponentContext> const&) at cppuhelper/source/factory.cxx:230:12
>  #5 in non-virtual thunk to cppu::(anonymous namespace)::OFactoryComponentHelper::createInstanceWithContext(com::sun::uno::Reference<com::sun::uno::XComponentContext> const&) at cppuhelper/source/factory.cxx
>  #6 in cppuhelper::ServiceManager::Data::Implementation::doCreateInstance(com::sun::uno::Reference<com::sun::uno::XComponentContext> const&) at cppuhelper/source/servicemanager.cxx:709:26
>  #7 in cppuhelper::ServiceManager::Data::Implementation::createInstance(com::sun::uno::Reference<com::sun::uno::XComponentContext> const&, bool) at cppuhelper/source/servicemanager.cxx:675:16
>  #8 in cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::uno::Reference<com::sun::uno::XComponentContext> const&) at cppuhelper/source/servicemanager.cxx:1006:36
>  #9 in non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::uno::Reference<com::sun::uno::XComponentContext> const&) at cppuhelper/source/servicemanager.cxx
>  #10 in i18npool::TransliterationImpl::loadBody(rtl::OUString const&, com::sun::uno::Reference<com::sun::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::uno::Reference<com::sun::i18n::XExtendedTransliteration>&, com::sun::lang::Locale const&) at i18npool/source/transliteration/transliterationImpl.cxx:630:5
>  #12 in i18npool::TransliterationImpl::loadModuleByImplName(rtl::OUString const&, com::sun::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
d319c4611e "INTEGRATION: CWS i18n24 (1.1.2); FILE
ADDED" vs. `sal_uInt16**` used in
i18npool/source/transliteration/textToPronounce_zh.cxx since
f4705bf0a3 "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
7696cd3902 "INTEGRATION: CWS i18n31 (1.4.60); FILE
MERGED" (and correctly used in
i18npool/source/indexentry/indexentrysupplier_asian.cxx since
58dcf0ffaf "INTEGRATION: CWS i18n31 (1.9.60); FILE
MERGED") vs. the original `()` used in
i18npool/source/transliteration/textToPronounce_zh.cxx ever since
f4705bf0a3 "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 9db03b879b
"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>
2023-04-13 08:23:59 +02:00

32 lines
1,014 B
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_CppunitTest_CppunitTest,i18npool_transliteration))
$(eval $(call gb_CppunitTest_add_exception_objects,i18npool_transliteration, \
i18npool/qa/cppunit/transliteration \
))
$(eval $(call gb_CppunitTest_use_components,i18npool_transliteration, \
i18npool/util/i18npool \
))\
$(eval $(call gb_CppunitTest_use_libraries,i18npool_transliteration, \
cppu \
cppuhelper \
sal \
))
$(eval $(call gb_CppunitTest_use_sdk_api,i18npool_transliteration))
$(eval $(call gb_CppunitTest_use_ure,i18npool_transliteration))
$(call gb_CppunitTest_get_target,i18npool_transliteration): $(call gb_Library_get_target,index_data)
# vim: set noet sw=4 ts=4: