mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-15 03:18:07 +00:00
fix save_if_interesting
The value of `classified`, `bits_new`, and `cksum`, were not always correctly maintained. 1. In the past, `afl->queue_top->exec_cksum` was always assigned when `add_to_queue`, however it became conditional sincecd57641705
. This doesn't change correctness because calibrate_case() will calculate the checksum. However, this mean one calibration run is wasted. 2. Sometimes `classified` is set incorrectly. For example, this code snippet ``` new_bits = has_new_bits_unclassified(afl, afl->virgin_bits); classified = 1; ``` should be changed to ``` new_bits = has_new_bits_unclassified(afl, afl->virgin_bits); if (new_bits) classified = 1; ``` This commit fixed above issues and use macros to make the code easier to understand. This should prevent to forget to set classified in the future (like the bug fixed by30c93d1321
). The macros also defers the calculations to where the values are really needed. This could save cpu if the code returns earlier. For example, if a case is timeout first and not timeout the second time, the current code does classify_counts, which is not always needed.
This commit is contained in:
@ -1216,7 +1216,6 @@ u8 *describe_op(afl_state_t *, u8, size_t);
|
||||
#endif
|
||||
u8 save_if_interesting(afl_state_t *, void *, u32, u8);
|
||||
u8 has_new_bits(afl_state_t *, u8 *);
|
||||
u8 has_new_bits_unclassified(afl_state_t *, u8 *);
|
||||
#ifndef AFL_SHOWMAP
|
||||
void classify_counts(afl_forkserver_t *);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user