/src/libfwnt/ossfuzz/lzx_fuzzer.cc
| Line | Count | Source | 
| 1 |  | /* | 
| 2 |  |  * OSS-Fuzz target for libfwnt LZX decompress function | 
| 3 |  |  * | 
| 4 |  |  * Copyright (C) 2009-2024, Joachim Metz <joachim.metz@gmail.com> | 
| 5 |  |  * | 
| 6 |  |  * Refer to AUTHORS for acknowledgements. | 
| 7 |  |  * | 
| 8 |  |  * This program is free software: you can redistribute it and/or modify | 
| 9 |  |  * it under the terms of the GNU Lesser General Public License as published by | 
| 10 |  |  * the Free Software Foundation, either version 3 of the License, or | 
| 11 |  |  * (at your option) any later version. | 
| 12 |  |  * | 
| 13 |  |  * This program is distributed in the hope that it will be useful, | 
| 14 |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 15 |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 16 |  |  * GNU General Public License for more details. | 
| 17 |  |  * | 
| 18 |  |  * You should have received a copy of the GNU Lesser General Public License | 
| 19 |  |  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | 
| 20 |  |  */ | 
| 21 |  |  | 
| 22 |  | #include <stddef.h> | 
| 23 |  | #include <stdint.h> | 
| 24 |  |  | 
| 25 |  | /* Note that some of the OSS-Fuzz engines use C++ | 
| 26 |  |  */ | 
| 27 |  | extern "C" { | 
| 28 |  |  | 
| 29 |  | #include "ossfuzz_libfwnt.h" | 
| 30 |  |  | 
| 31 |  | int LLVMFuzzerTestOneInput( | 
| 32 |  |      const uint8_t *data, | 
| 33 |  |      size_t size ) | 
| 34 | 4.73k | { | 
| 35 | 4.73k |   uint8_t uncompressed_data[ 64 * 1024 ]; | 
| 36 |  |  | 
| 37 | 4.73k |   size_t uncompressed_data_size = 64 * 1024; | 
| 38 |  |  | 
| 39 | 4.73k |   libfwnt_lzx_decompress( | 
| 40 | 4.73k |    data, | 
| 41 | 4.73k |    size, | 
| 42 | 4.73k |    uncompressed_data, | 
| 43 | 4.73k |    &uncompressed_data_size, | 
| 44 | 4.73k |    NULL ); | 
| 45 |  |  | 
| 46 | 4.73k |   return( 0 ); | 
| 47 | 4.73k | } | 
| 48 |  |  | 
| 49 |  | } /* extern "C" */ | 
| 50 |  |  |