mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-15 03:18:07 +00:00
maybe_grow->ck_maybe_grow
This commit is contained in:
@ -11,7 +11,8 @@ ifdef STATIC
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq "$(shell echo '$(HASH)include <libdeflate.h>@int main() { struct libdeflate_compressor *d = libdeflate_alloc_compressor(1); return 0;}' | tr @ '\n' | $(CC) $(CFLAGS) -x c - -o .test2 -ldeflate 2>/dev/null && echo 1 || echo 0 ; rm -f .test2 )" "1"
|
ifeq "$(shell echo '$(HASH)include <libdeflate.h>@int main() { struct libdeflate_compressor *d = libdeflate_alloc_compressor(1); return 0;}' | tr @ '\n' | $(CC) $(CFLAGS) -x c - -o .test2 -ldeflate 2>/dev/null && echo 1 || echo 0 ; rm -f .test2 )" "1"
|
||||||
CFLAGS += -ldeflate -DUSE_DEFLATE=1
|
CFLAGS += -DUSE_DEFLATE=1
|
||||||
|
LDFLAGS += -ldeflate
|
||||||
$(info libdeflate-dev was detected, using compression)
|
$(info libdeflate-dev was detected, using compression)
|
||||||
else
|
else
|
||||||
$(warn did not find libdeflate-dev, cannot use compression)
|
$(warn did not find libdeflate-dev, cannot use compression)
|
||||||
|
@ -356,7 +356,7 @@ int recv_testcase(int s, void **buf, size_t *max_len) {
|
|||||||
|
|
||||||
if ((size & 0xff000000) != 0xff000000) {
|
if ((size & 0xff000000) != 0xff000000) {
|
||||||
|
|
||||||
*buf = maybe_grow(buf, max_len, size);
|
*buf = ck_maybe_grow(buf, max_len, size);
|
||||||
received = 0;
|
received = 0;
|
||||||
// fprintf(stderr, "unCOMPRESS (%u)\n", size);
|
// fprintf(stderr, "unCOMPRESS (%u)\n", size);
|
||||||
while (received < size &&
|
while (received < size &&
|
||||||
@ -368,7 +368,7 @@ int recv_testcase(int s, void **buf, size_t *max_len) {
|
|||||||
#ifdef USE_DEFLATE
|
#ifdef USE_DEFLATE
|
||||||
u32 clen;
|
u32 clen;
|
||||||
size -= 0xff000000;
|
size -= 0xff000000;
|
||||||
*buf = maybe_grow(buf, max_len, size);
|
*buf = ck_maybe_grow(buf, max_len, size);
|
||||||
received = 0;
|
received = 0;
|
||||||
while (received < 4 &&
|
while (received < 4 &&
|
||||||
(ret = recv(s, &clen + received, 4 - received, 0)) > 0)
|
(ret = recv(s, &clen + received, 4 - received, 0)) > 0)
|
||||||
@ -377,7 +377,7 @@ int recv_testcase(int s, void **buf, size_t *max_len) {
|
|||||||
// fprintf(stderr, "received clen information of %d\n", clen);
|
// fprintf(stderr, "received clen information of %d\n", clen);
|
||||||
if (clen < 1)
|
if (clen < 1)
|
||||||
FATAL("did not receive valid compressed len information: %u", clen);
|
FATAL("did not receive valid compressed len information: %u", clen);
|
||||||
buf2 = maybe_grow((void **)&buf2, &buf2_len, clen);
|
buf2 = ck_maybe_grow((void **)&buf2, &buf2_len, clen);
|
||||||
received = 0;
|
received = 0;
|
||||||
while (received < clen &&
|
while (received < clen &&
|
||||||
(ret = recv(s, buf2 + received, clen - received, 0)) > 0)
|
(ret = recv(s, buf2 + received, clen - received, 0)) > 0)
|
||||||
@ -566,7 +566,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
sharedmem_t shm = {0};
|
sharedmem_t shm = {0};
|
||||||
fsrv->trace_bits = afl_shm_init(&shm, map_size, 0);
|
fsrv->trace_bits = afl_shm_init(&shm, map_size, 0);
|
||||||
|
|
||||||
in_data = maybe_grow((void **)&in_data, &max_len, 65536);
|
in_data = ck_maybe_grow((void **)&in_data, &max_len, 65536);
|
||||||
|
|
||||||
atexit(at_exit_handler);
|
atexit(at_exit_handler);
|
||||||
setup_signal_handlers();
|
setup_signal_handlers();
|
||||||
@ -637,7 +637,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
#ifdef USE_DEFLATE
|
#ifdef USE_DEFLATE
|
||||||
compressor = libdeflate_alloc_compressor(1);
|
compressor = libdeflate_alloc_compressor(1);
|
||||||
decompressor = libdeflate_alloc_decompressor();
|
decompressor = libdeflate_alloc_decompressor();
|
||||||
buf2 = maybe_grow((void **)&buf2, &buf2_len, map_size + 16);
|
buf2 = ck_maybe_grow((void **)&buf2, &buf2_len, map_size + 16);
|
||||||
lenptr = (u32 *)(buf2 + 4);
|
lenptr = (u32 *)(buf2 + 4);
|
||||||
fprintf(stderr, "Compiled with compression support\n");
|
fprintf(stderr, "Compiled with compression support\n");
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user