Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / vcl / workben / pptfuzzer.cxx
blobdfcc41abc50c86fa68003006b9e78a2c134a8bc6
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 * emfio_component_getFactory( const char* , void* , void* );
19 void * sd_component_getFactory( const char* , void* , void* );
20 void * i18npool_component_getFactory( const char* , void* , void* );
21 void * ucb_component_getFactory( const char* , void* , void* );
23 void * com_sun_star_i18n_LocaleDataImpl_get_implementation( void *, void * );
24 void * com_sun_star_i18n_BreakIterator_Unicode_get_implementation( void *, void * );
25 void * com_sun_star_i18n_BreakIterator_get_implementation( void *, void * );
26 void * com_sun_star_comp_framework_Desktop_get_implementation( void *, void * );
27 void * com_sun_star_i18n_CharacterClassification_Unicode_get_implementation( void *, void * );
28 void * com_sun_star_i18n_CharacterClassification_get_implementation( void *, void * );
29 void * com_sun_star_i18n_NativeNumberSupplier_get_implementation( void *, void * );
30 void * com_sun_star_i18n_NumberFormatCodeMapper_get_implementation( void *, void * );
31 void * com_sun_star_i18n_Transliteration_get_implementation( void *, void * );
32 void * com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation( void *, void * );
33 void * com_sun_star_drawing_SvxShapeCollection_get_implementation( void *, void * );
34 void * SfxDocumentMetaData_get_implementation( void *, void * );
35 void * unoxml_component_getFactory( const char* , void* , void* );
36 void * com_sun_star_animations_AnimateColor_get_implementation( void *, void * );
37 void * com_sun_star_animations_AnimateMotion_get_implementation( void *, void * );
38 void * com_sun_star_animations_AnimateSet_get_implementation( void *, void * );
39 void * com_sun_star_animations_AnimateTransform_get_implementation( void *, void * );
40 void * com_sun_star_animations_Animate_get_implementation( void *, void * );
41 void * com_sun_star_animations_Audio_get_implementation( void *, void * );
42 void * com_sun_star_animations_Command_get_implementation( void *, void * );
43 void * com_sun_star_animations_IterateContainer_get_implementation( void *, void * );
44 void * com_sun_star_animations_ParallelTimeContainer_get_implementation( void *, void * );
45 void * com_sun_star_animations_SequenceTimeContainer_get_implementation( void *, void * );
46 void * com_sun_star_animations_TransitionFilter_get_implementation( void *, void * );
47 void * com_sun_star_comp_comphelper_OPropertyBag( void *, void * );
48 void * com_sun_star_comp_uui_UUIInteractionHandler_get_implementation( void *, void * );
51 const lib_to_factory_mapping *
52 lo_get_factory_map(void)
54 static lib_to_factory_mapping map[] = {
55 { "libemfiolo.a", emfio_component_getFactory },
56 { "libsdlo.a", sd_component_getFactory },
57 { "libunoxmllo.a", unoxml_component_getFactory },
58 { "libi18npoollo.a", i18npool_component_getFactory },
59 { "libucb1.a", ucb_component_getFactory },
60 { 0, 0 }
63 return map;
66 const lib_to_constructor_mapping *
67 lo_get_constructor_map(void)
69 static lib_to_constructor_mapping map[] = {
70 { "com_sun_star_i18n_LocaleDataImpl_get_implementation", com_sun_star_i18n_LocaleDataImpl_get_implementation },
71 { "com_sun_star_i18n_BreakIterator_Unicode_get_implementation", com_sun_star_i18n_BreakIterator_Unicode_get_implementation },
72 { "com_sun_star_i18n_BreakIterator_get_implementation", com_sun_star_i18n_BreakIterator_get_implementation },
73 { "com_sun_star_comp_framework_Desktop_get_implementation", com_sun_star_comp_framework_Desktop_get_implementation },
74 { "com_sun_star_i18n_CharacterClassification_Unicode_get_implementation", com_sun_star_i18n_CharacterClassification_Unicode_get_implementation },
75 { "com_sun_star_i18n_CharacterClassification_get_implementation", com_sun_star_i18n_CharacterClassification_get_implementation },
76 { "com_sun_star_i18n_NativeNumberSupplier_get_implementation", com_sun_star_i18n_NativeNumberSupplier_get_implementation },
77 { "com_sun_star_i18n_NumberFormatCodeMapper_get_implementation", com_sun_star_i18n_NumberFormatCodeMapper_get_implementation },
78 { "com_sun_star_i18n_Transliteration_get_implementation", com_sun_star_i18n_Transliteration_get_implementation },
79 { "com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation", com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation },
80 { "com_sun_star_drawing_SvxShapeCollection_get_implementation", com_sun_star_drawing_SvxShapeCollection_get_implementation },
81 { "SfxDocumentMetaData_get_implementation", SfxDocumentMetaData_get_implementation },
82 { "com_sun_star_animations_AnimateColor_get_implementation", com_sun_star_animations_AnimateColor_get_implementation },
83 { "com_sun_star_animations_AnimateMotion_get_implementation", com_sun_star_animations_AnimateMotion_get_implementation },
84 { "com_sun_star_animations_AnimateSet_get_implementation", com_sun_star_animations_AnimateSet_get_implementation },
85 { "com_sun_star_animations_AnimateTransform_get_implementation", com_sun_star_animations_AnimateTransform_get_implementation },
86 { "com_sun_star_animations_Animate_get_implementation", com_sun_star_animations_Animate_get_implementation },
87 { "com_sun_star_animations_Audio_get_implementation", com_sun_star_animations_Audio_get_implementation },
88 { "com_sun_star_animations_Command_get_implementation", com_sun_star_animations_Command_get_implementation },
89 { "com_sun_star_animations_IterateContainer_get_implementation", com_sun_star_animations_IterateContainer_get_implementation },
90 { "com_sun_star_animations_ParallelTimeContainer_get_implementation", com_sun_star_animations_ParallelTimeContainer_get_implementation },
91 { "com_sun_star_animations_SequenceTimeContainer_get_implementation", com_sun_star_animations_SequenceTimeContainer_get_implementation },
92 { "com_sun_star_animations_TransitionFilter_get_implementation", com_sun_star_animations_TransitionFilter_get_implementation },
93 { "com_sun_star_comp_comphelper_OPropertyBag", com_sun_star_comp_comphelper_OPropertyBag },
94 { "com_sun_star_comp_uui_UUIInteractionHandler_get_implementation", com_sun_star_comp_uui_UUIInteractionHandler_get_implementation },
95 { 0, 0 }
98 return map;
101 extern "C" void* lo_get_custom_widget_func(const char*)
103 return nullptr;
106 extern "C" void* SdCreateDialogFactory()
108 return nullptr;
111 extern "C" bool TestImportPPT(SvStream &rStream);
113 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
115 if (__lsan_disable)
116 __lsan_disable();
118 CommonInitialize(argc, argv);
120 comphelper::getProcessServiceFactory()->createInstance("com.sun.star.comp.Draw.PresentationDocument");
122 if (__lsan_enable)
123 __lsan_enable();
125 return 0;
128 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
130 SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
131 (void)TestImportPPT(aStream);
132 //fontconfigs alloc mechanism is too complicated for lsan/valgrind so
133 //force the fontconfig options to be released now, they are demand loaded
134 //so will be recreated if necessary
135 SvpSalGraphics::getPlatformGlyphCache().ClearFontOptions();
136 return 0;
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */