Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / vcl / workben / ww2fuzzer.cxx
blobc6a44111f5107629c01be37674267a0e1a53408a
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_i18n_Transliteration_get_implementation( void *, void * );
36 void * com_sun_star_text_DefaultNumberingProvider_get_implementation( void *, void * );
37 void * com_sun_star_comp_uri_UriReferenceFactory_get_implementation( void *, void * );
40 const lib_to_factory_mapping *
41 lo_get_factory_map(void)
43 static lib_to_factory_mapping map[] = {
44 { "libunoxmllo.a", unoxml_component_getFactory },
45 { "libi18npoollo.a", i18npool_component_getFactory },
46 { "libemfiolo.a", emfio_component_getFactory },
47 { "libucb1.a", ucb_component_getFactory },
48 { 0, 0 }
51 return map;
54 const lib_to_constructor_mapping *
55 lo_get_constructor_map(void)
57 static lib_to_constructor_mapping map[] = {
58 { "com_sun_star_comp_framework_Desktop_get_implementation", com_sun_star_comp_framework_Desktop_get_implementation },
59 { "com_sun_star_i18n_LocaleDataImpl_get_implementation", com_sun_star_i18n_LocaleDataImpl_get_implementation },
60 { "com_sun_star_i18n_BreakIterator_Unicode_get_implementation", com_sun_star_i18n_BreakIterator_Unicode_get_implementation },
61 { "com_sun_star_i18n_BreakIterator_get_implementation", com_sun_star_i18n_BreakIterator_get_implementation },
62 { "SfxDocumentMetaData_get_implementation", SfxDocumentMetaData_get_implementation },
63 { "com_sun_star_i18n_CharacterClassification_Unicode_get_implementation", com_sun_star_i18n_CharacterClassification_Unicode_get_implementation },
64 { "com_sun_star_i18n_CharacterClassification_get_implementation", com_sun_star_i18n_CharacterClassification_get_implementation },
65 { "com_sun_star_i18n_NativeNumberSupplier_get_implementation", com_sun_star_i18n_NativeNumberSupplier_get_implementation },
66 { "com_sun_star_i18n_NumberFormatCodeMapper_get_implementation", com_sun_star_i18n_NumberFormatCodeMapper_get_implementation },
67 { "com_sun_star_comp_graphic_GraphicProvider_get_implementation", com_sun_star_comp_graphic_GraphicProvider_get_implementation },
68 { "IndexedPropertyValuesContainer_get_implementation", IndexedPropertyValuesContainer_get_implementation },
69 { "com_sun_star_comp_uui_UUIInteractionHandler_get_implementation", com_sun_star_comp_uui_UUIInteractionHandler_get_implementation },
70 { "com_sun_star_i18n_Transliteration_get_implementation", com_sun_star_i18n_Transliteration_get_implementation },
71 { "com_sun_star_text_DefaultNumberingProvider_get_implementation", com_sun_star_text_DefaultNumberingProvider_get_implementation },
72 { "com_sun_star_comp_uri_UriReferenceFactory_get_implementation", com_sun_star_comp_uri_UriReferenceFactory_get_implementation},
73 { 0, 0 }
76 return map;
79 extern "C" void* lo_get_custom_widget_func(const char*)
81 return nullptr;
84 extern "C" void* SwCreateDialogFactory()
86 return nullptr;
89 extern "C" bool TestImportWW2(SvStream &rStream);
91 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
93 TypicalFuzzerInitialize(argc, argv);
94 return 0;
97 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
99 SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
100 (void)TestImportWW2(aStream);
101 //fontconfigs alloc mechanism is too complicated for lsan/valgrind so
102 //force the fontconfig options to be released now, they are demand loaded
103 //so will be recreated if necessary
104 SvpSalGraphics::getPlatformGlyphCache().ClearFontOptions();
105 return 0;
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */