nDPI/src/lib
Ivan Nardi f5905a62c7
Fix invalid memory access (#2374)
The bug is triggered when `pe_offset == (u_int32_t)-1`

```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==23719==ERROR: AddressSanitizer: SEGV on unknown address 0x5081000002b3 (pc 0x55c69274ac72 bp 0x7ffffffc8e70 sp 0x7ffffffc8cc0 T0)
==23719==The signal is caused by a READ memory access.
    #0 0x55c69274ac72 in ndpi_search_portable_executable /home/ivan/svnrepos/nDPI/src/lib/ndpi_main.c:8191:7
    #1 0x55c69271606b in ndpi_internal_detection_process_packet /home/ivan/svnrepos/nDPI/src/lib/ndpi_main.c:8596:5
    #2 0x55c69270f58f in ndpi_detection_process_packet /home/ivan/svnrepos/nDPI/src/lib/ndpi_main.c:8629:22
    #3 0x55c6926a07e7 in LLVMFuzzerTestOneInput /home/ivan/svnrepos/nDPI/fuzz/fuzz_process_packet.c:24:5
    #4 0x55c6925a79b6 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/ivan/svnrepos/nDPI/fuzz/fuzz_process_packet+0x64e9b6) (BuildId: ec46c60ec7e03ebfb3d825bd6308d0a8d6e9803b)
    #5 0x55c692590d48 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/home/ivan/svnrepos/nDPI/fuzz/fuzz_process_packet+0x637d48) (BuildId: ec46c60ec7e03ebfb3d825bd6308d0a8d6e9803b)
    #6 0x55c69259685a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/ivan/svnrepos/nDPI/fuzz/fuzz_process_packet+0x63d85a) (BuildId: ec46c60ec7e03ebfb3d825bd6308d0a8d6e9803b)
    #7 0x55c6925c0e02 in main (/home/ivan/svnrepos/nDPI/fuzz/fuzz_process_packet+0x667e02) (BuildId: ec46c60ec7e03ebfb3d825bd6308d0a8d6e9803b)
    #8 0x7f8e99793082 in __libc_start_main /build/glibc-wuryBv/glibc-2.31/csu/../csu/libc-start.c:308:16
    #9 0x55c69258baed in _start (/home/ivan/svnrepos/nDPI/fuzz/fuzz_process_packet+0x632aed) (BuildId: ec46c60ec7e03ebfb3d825bd6308d0a8d6e9803b)
```

Found by oss-fuzzer
See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=67881
2024-04-06 20:23:06 +02:00
..
inc_generated Added missing telegram networks 2024-02-22 22:04:54 +01:00
protocols Get rid of Apache Kafka false positives (#2372) 2024-04-06 16:59:38 +02:00
third_party Patrica tree: fix handling of mac addresses (#2362) 2024-04-03 14:10:37 +02:00
Makefile.in Fixed yet another another "unused function" warning. (#2367) 2024-04-04 20:41:45 +02:00
ndpi_analyze.c Fix some warnings reported by CODESonar (#2227) 2024-01-12 13:30:43 +01:00
ndpi_binary_bitmap.c Fixes bitmap memory calculation 2024-03-11 17:59:24 +01:00
ndpi_bitmap.c Added support for roaring bitmap v3 (#2355) 2024-03-25 08:15:19 +01:00
ndpi_bitmap64_fuse.c Added support for roaring bitmap v3 (#2355) 2024-03-25 08:15:19 +01:00
ndpi_classify.c Fix some warnings reported by CODESonar (#2227) 2024-01-12 13:30:43 +01:00
ndpi_community_id.c Updated (C) 2023-04-28 23:00:33 +02:00
ndpi_content_match.c.inc Add Path of Exile protocol dissector (#2337) 2024-03-06 19:59:09 +01:00
ndpi_dga_match.c.inc Updated (C) 2023-04-28 23:00:33 +02:00
ndpi_domain_classify.c Added support for roaring bitmap v3 (#2355) 2024-03-25 08:15:19 +01:00
ndpi_domains.c Fix function parameters check on domain code (#2296) 2024-02-01 17:06:16 +01:00
ndpi_filter.c Code cleanup 2023-08-31 09:14:17 +02:00
ndpi_geoip.c Disable -Wno-unused-parameter -Wno-unused-function. (#2358) 2024-04-03 14:10:21 +02:00
ndpi_hash.c Minor hash improvement 2024-02-04 20:23:49 +01:00
ndpi_main.c Fix invalid memory access (#2374) 2024-04-06 20:23:06 +02:00
ndpi_memory.c FreeBSD compilation fix 2023-03-14 22:16:57 +01:00
ndpi_serializer.c Disable -Wno-unused-parameter -Wno-unused-function. (#2358) 2024-04-03 14:10:21 +02:00
ndpi_utils.c Added binary data transfer risk alert 2024-04-03 15:41:26 +02:00