Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / vcl / workben / rtffuzzer.cxx
blob028efda903517337e01af64aa5ba7b5aaf039369
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 * i18npool_component_getFactory( const char* , void* , void* );
21 void * com_sun_star_i18n_LocaleDataImpl_get_implementation( void *, void * );
22 void * com_sun_star_i18n_BreakIterator_Unicode_get_implementation( void *, void * );
23 void * com_sun_star_i18n_BreakIterator_get_implementation( void *, void * );
24 void * com_sun_star_comp_framework_Desktop_get_implementation( void *, void * );
25 void * com_sun_star_i18n_CharacterClassification_Unicode_get_implementation( void *, void * );
26 void * com_sun_star_i18n_CharacterClassification_get_implementation( void *, void * );
27 void * com_sun_star_i18n_NativeNumberSupplier_get_implementation( void *, void * );
28 void * com_sun_star_i18n_NumberFormatCodeMapper_get_implementation( void *, void * );
29 void * com_sun_star_i18n_Transliteration_get_implementation( void *, void * );
30 void * com_sun_star_comp_Writer_RtfFilter_get_implementation( void *, void * );
33 const lib_to_factory_mapping *
34 lo_get_factory_map(void)
36 static lib_to_factory_mapping map[] = {
37 { "libemfiolo.a", emfio_component_getFactory },
38 { "libi18npoollo.a", i18npool_component_getFactory },
39 { 0, 0 }
42 return map;
45 const lib_to_constructor_mapping *
46 lo_get_constructor_map(void)
48 static lib_to_constructor_mapping map[] = {
49 { "com_sun_star_i18n_LocaleDataImpl_get_implementation", com_sun_star_i18n_LocaleDataImpl_get_implementation },
50 { "com_sun_star_i18n_BreakIterator_Unicode_get_implementation", com_sun_star_i18n_BreakIterator_Unicode_get_implementation },
51 { "com_sun_star_i18n_BreakIterator_get_implementation", com_sun_star_i18n_BreakIterator_get_implementation },
52 { "com_sun_star_comp_framework_Desktop_get_implementation", com_sun_star_comp_framework_Desktop_get_implementation },
53 { "com_sun_star_i18n_CharacterClassification_Unicode_get_implementation", com_sun_star_i18n_CharacterClassification_Unicode_get_implementation },
54 { "com_sun_star_i18n_CharacterClassification_get_implementation", com_sun_star_i18n_CharacterClassification_get_implementation },
55 { "com_sun_star_i18n_NativeNumberSupplier_get_implementation", com_sun_star_i18n_NativeNumberSupplier_get_implementation },
56 { "com_sun_star_i18n_NumberFormatCodeMapper_get_implementation", com_sun_star_i18n_NumberFormatCodeMapper_get_implementation },
57 { "com_sun_star_i18n_Transliteration_get_implementation", com_sun_star_i18n_Transliteration_get_implementation },
58 { "com_sun_star_comp_Writer_RtfFilter_get_implementation", com_sun_star_comp_Writer_RtfFilter_get_implementation },
59 { 0, 0 }
62 return map;
65 extern "C" bool TestImportRTF(SvStream &rStream);
67 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
69 TypicalFuzzerInitialize(argc, argv);
70 return 0;
73 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
75 SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
76 (void)TestImportRTF(aStream);
77 //fontconfigs alloc mechanism is too complicated for lsan/valgrind so
78 //force the fontconfig options to be released now, they are demand loaded
79 //so will be recreated if necessary
80 SvpSalGraphics::getPlatformGlyphCache().ClearFontOptions();
81 return 0;
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */