Allocation Size Too Big error at dns_request_parse in /src/dns_protocol.c:49:14
I triggered a SEGV bug reported by AddressSanitizer. The AddressSanitizer (ASan) report below indicates an allocation-size-too-big error, where the program attempted to allocate an extremely large memory size (0xfffffffffffffffe, adjusted to 0x800 after alignment). This size exceeds the maximum supported allocation size (0x10000000000). The issue occurs during a call to malloc at line 49 in the dns_request_parse function within dns_protocol.c. The error suggests that an invalid or unreasonably large size was passed to malloc, likely due to incorrect input handling or a miscalculation in the size parameter. To fix this, review the logic in dns_request_parse to ensure proper validation of input sizes and prevent the creation of such oversized allocation requests.
Asan Report:
=================================================================
==3132760==ERROR: AddressSanitizer: requested allocation size 0xfffffffffffffffe (0x800 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0x10000000000 (thread T0)
#0 0x493b1d in malloc (/root/protocolFuzz/dns/simple-dns/src/simple-dns+0x493b1d)
#1 0x4c41a3 in dns_request_parse /root/protocolFuzz/dns/simple-dns/src/dns_protocol.c:49:14
==3132760==HINT: if you don't care about these errors you may set allocator_may_return_null=1
SUMMARY: AddressSanitizer: allocation-size-too-big (/root/protocolFuzz/dns/simple-dns/src/simple-dns+0x493b1d) in malloc
==3132760==ABORTING