Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / vcl / workben / ww6fuzzer.cxx
blobd98b7a579448d7440229fb18105b88e55830e691
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <tools/stream.hxx>
11 #include <vcl/FilterConfigItem.hxx>
12 #include "commonfuzzer.hxx"
14 #include <config_features.h>
15 #include <osl/detail/component-mapping.h>
17 extern "C" {
18 void * unoxml_component_getFactory( const char* , void* , void* );
19 void * i18npool_component_getFactory( const char* , void* , void* );
20 void * ucb_component_getFactory( const char* , void* , void* );
21 void * emfio_component_getFactory( const char* , void* , void* );
23 void * com_sun_star_comp_framework_Desktop_get_implementation( void *, void * );
24 void * com_sun_star_i18n_LocaleDataImpl_get_implementation( void *, void * );
25 void * com_sun_star_i18n_BreakIterator_Unicode_get_implementation( void *, void * );
26 void * com_sun_star_i18n_BreakIterator_get_implementation( void *, void * );
27 void * SfxDocumentMetaData_get_implementation( void *, void * );
28 void * com_sun_star_i18n_CharacterClassification_Unicode_get_implementation( void *, void * );
29 void * com_sun_star_i18n_CharacterClassification_get_implementation( void *, void * );
30 void * com_sun_star_i18n_NativeNumberSupplier_get_implementation( void *, void * );
31 void * com_sun_star_i18n_NumberFormatCodeMapper_get_implementation( void *, void * );
32 void * com_sun_star_comp_graphic_GraphicProvider_get_implementation( void *, void * );
33 void * IndexedPropertyValuesContainer_get_implementation( void *, void * );
34 void * com_sun_star_comp_uui_UUIInteractionHandler_get_implementation( void *, void * );
35 void * com_sun_star_comp_comphelper_OPropertyBag( void *, void * );
36 void * com_sun_star_i18n_Transliteration_get_implementation( void *, void * );
37 void * com_sun_star_text_DefaultNumberingProvider_get_implementation( void *, void * );
38 void * com_sun_star_comp_uri_UriReferenceFactory_get_implementation( void *, void * );
41 const lib_to_factory_mapping *
42 lo_get_factory_map(void)
44 static lib_to_factory_mapping map[] = {
45 { "libunoxmllo.a", unoxml_component_getFactory },
46 { "libi18npoollo.a", i18npool_component_getFactory },
47 { "libemfiolo.a", emfio_component_getFactory },
48 { "libucb1.a", ucb_component_getFactory },
49 { 0, 0 }
52 return map;
55 const lib_to_constructor_mapping *
56 lo_get_constructor_map(void)
58 static lib_to_constructor_mapping map[] = {
59 { "com_sun_star_comp_framework_Desktop_get_implementation", com_sun_star_comp_framework_Desktop_get_implementation },
60 { "com_sun_star_i18n_LocaleDataImpl_get_implementation", com_sun_star_i18n_LocaleDataImpl_get_implementation },
61 { "com_sun_star_i18n_BreakIterator_Unicode_get_implementation", com_sun_star_i18n_BreakIterator_Unicode_get_implementation },
62 { "com_sun_star_i18n_BreakIterator_get_implementation", com_sun_star_i18n_BreakIterator_get_implementation },
63 { "SfxDocumentMetaData_get_implementation", SfxDocumentMetaData_get_implementation },
64 { "com_sun_star_i18n_CharacterClassification_Unicode_get_implementation", com_sun_star_i18n_CharacterClassification_Unicode_get_implementation },
65 { "com_sun_star_i18n_CharacterClassification_get_implementation", com_sun_star_i18n_CharacterClassification_get_implementation },
66 { "com_sun_star_i18n_NativeNumberSupplier_get_implementation", com_sun_star_i18n_NativeNumberSupplier_get_implementation },
67 { "com_sun_star_i18n_NumberFormatCodeMapper_get_implementation", com_sun_star_i18n_NumberFormatCodeMapper_get_implementation },
68 { "com_sun_star_comp_graphic_GraphicProvider_get_implementation", com_sun_star_comp_graphic_GraphicProvider_get_implementation },
69 { "IndexedPropertyValuesContainer_get_implementation", IndexedPropertyValuesContainer_get_implementation },
70 { "com_sun_star_comp_uui_UUIInteractionHandler_get_implementation", com_sun_star_comp_uui_UUIInteractionHandler_get_implementation },
71 { "com_sun_star_comp_comphelper_OPropertyBag", com_sun_star_comp_comphelper_OPropertyBag },
72 { "com_sun_star_i18n_Transliteration_get_implementation", com_sun_star_i18n_Transliteration_get_implementation },
73 { "com_sun_star_text_DefaultNumberingProvider_get_implementation", com_sun_star_text_DefaultNumberingProvider_get_implementation },
74 { "com_sun_star_comp_uri_UriReferenceFactory_get_implementation", com_sun_star_comp_uri_UriReferenceFactory_get_implementation},
75 { 0, 0 }
78 return map;
81 extern "C" void* lo_get_custom_widget_func(const char*)
83 return nullptr;
86 extern "C" void* SwCreateDialogFactory()
88 return nullptr;
91 extern "C" bool TestImportWW6(SvStream &rStream);
93 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
95 TypicalFuzzerInitialize(argc, argv);
96 return 0;
99 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
101 SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
102 (void)TestImportWW6(aStream);
103 //fontconfigs alloc mechanism is too complicated for lsan/valgrind so
104 //force the fontconfig options to be released now, they are demand loaded
105 //so will be recreated if necessary
106 SvpSalGraphics::getPlatformGlyphCache().ClearFontOptions();
107 return 0;
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */