diff options
author | van Hauser <vh@thc.org> | 2021-12-11 13:00:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-11 13:00:19 +0100 |
commit | 5ec91ad5291228f6ef6d9b69605a9b752ef28fa0 (patch) | |
tree | 03d433f881e6c49dbfd6e6093a6943937a07dec7 | |
parent | 74aa826b60601eb59038bf61298b07eb20944caa (diff) | |
parent | 602eafc223d76987e447b431fc75903147a40c38 (diff) | |
download | afl++-5ec91ad5291228f6ef6d9b69605a9b752ef28fa0.tar.gz |
Merge pull request #1205 from yuawn/rename
rename active_paths
-rw-r--r-- | include/afl-fuzz.h | 2 | ||||
-rw-r--r-- | include/xxhash.h | 49 | ||||
-rw-r--r-- | instrumentation/split-compares-pass.so.cc | 97 | ||||
-rw-r--r-- | src/afl-fuzz-init.c | 8 | ||||
-rw-r--r-- | src/afl-fuzz-one.c | 4 | ||||
-rw-r--r-- | src/afl-fuzz-queue.c | 2 | ||||
-rw-r--r-- | src/afl-fuzz-redqueen.c | 2 | ||||
-rw-r--r-- | test/test-cmplog.c | 17 | ||||
-rw-r--r-- | test/test-fp_Infcases.c | 26 | ||||
-rw-r--r-- | test/test-fp_NaNcases.c | 16 | ||||
-rw-r--r-- | test/test-fp_minusZerocases.c | 10 | ||||
-rw-r--r-- | utils/libtokencap/libtokencap.so.c | 8 |
12 files changed, 131 insertions, 110 deletions
diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h index baab8ec9..e59b3781 100644 --- a/include/afl-fuzz.h +++ b/include/afl-fuzz.h @@ -527,7 +527,7 @@ typedef struct afl_state { double *alias_probability; /* alias weighted probabilities */ u32 * alias_table; /* alias weighted random lookup table */ - u32 active_paths; /* enabled entries in the queue */ + u32 active_items; /* enabled entries in the queue */ u8 *var_bytes; /* Bytes that appear to be variable */ diff --git a/include/xxhash.h b/include/xxhash.h index 0ca2b852..8cf4a345 100644 --- a/include/xxhash.h +++ b/include/xxhash.h @@ -1010,7 +1010,7 @@ XXH128_hashFromCanonical(const XXH128_canonical_t *src); * These declarations should only be used with static linking. * Never use them in association with dynamic linking! ***************************************************************************** -*/ + */ /* * These definitions are only present to allow static allocation @@ -1435,9 +1435,9 @@ XXH_PUBLIC_API XXH128_hash_t XXH128(const void *data, size_t len, #define XXH_OLD_NAMES #undef XXH_OLD_NAMES /* don't actually use, it is ugly. */ #endif /* XXH_DOXYGEN */ -/*! - * @} - */ + /*! + * @} + */ #ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command \ line for example */ @@ -1601,6 +1601,7 @@ static void *XXH_memcpy(void *dest, const void *src, size_t size) { static_assert((c), m); \ \ } while (0) + #elif defined(__cplusplus) && (__cplusplus >= 201103L) /* C++11 */ #define XXH_STATIC_ASSERT_WITH_MESSAGE(c, m) \ do { \ @@ -1608,6 +1609,7 @@ static void *XXH_memcpy(void *dest, const void *src, size_t size) { static_assert((c), m); \ \ } while (0) + #else #define XXH_STATIC_ASSERT_WITH_MESSAGE(c, m) \ do { \ @@ -1619,6 +1621,7 @@ static void *XXH_memcpy(void *dest, const void *src, size_t size) { }; \ \ } while (0) + #endif #define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c), #c) #endif @@ -1830,7 +1833,7 @@ static int XXH_isLittleEndian(void) { return one.c[0]; } -\ + #define XXH_CPU_LITTLE_ENDIAN XXH_isLittleEndian() #endif #endif @@ -2079,23 +2082,6 @@ static xxh_u32 XXH32_avalanche(xxh_u32 h32) { #define XXH_get32bits(p) XXH_readLE32_align(p, align) -/*! - * @internal - * @brief Processes the last 0-15 bytes of @p ptr. - * - * There may be up to 15 bytes remaining to consume from the input. - * This final stage will digest them to ensure that all input bytes are present - * in the final mix. - * - * @param h32 The hash to finalize. - * @param ptr The pointer to the remaining input. - * @param len The remaining length, modulo 16. - * @param align Whether @p ptr is aligned. - * @return The finalized hash. - */ -static xxh_u32 XXH32_finalize(xxh_u32 h32, const xxh_u8 *ptr, size_t len, - XXH_alignment align) { -\ #define XXH_PROCESS1 \ do { \ \ @@ -2113,6 +2099,23 @@ static xxh_u32 XXH32_finalize(xxh_u32 h32, const xxh_u8 *ptr, size_t len, \ } while (0) +/*! + * @internal + * @brief Processes the last 0-15 bytes of @p ptr. + * + * There may be up to 15 bytes remaining to consume from the input. + * This final stage will digest them to ensure that all input bytes are present + * in the final mix. + * + * @param h32 The hash to finalize. + * @param ptr The pointer to the remaining input. + * @param len The remaining length, modulo 16. + * @param align Whether @p ptr is aligned. + * @return The finalized hash. + */ +static xxh_u32 XXH32_finalize(xxh_u32 h32, const xxh_u8 *ptr, size_t len, + XXH_alignment align) { + /* Compact rerolled version */ if (XXH_REROLL) { @@ -3385,6 +3388,7 @@ enum XXH_VECTOR_TYPE /* fake enum */ { (outHi) = vget_high_u32(vreinterpretq_u32_u64(in)); \ \ } while (0) + #else #define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ do { \ @@ -3393,6 +3397,7 @@ enum XXH_VECTOR_TYPE /* fake enum */ { (outHi) = vshrn_n_u64((in), 32); \ \ } while (0) + #endif #endif /* XXH_VECTOR == XXH_NEON */ diff --git a/instrumentation/split-compares-pass.so.cc b/instrumentation/split-compares-pass.so.cc index c06118c0..451258d9 100644 --- a/instrumentation/split-compares-pass.so.cc +++ b/instrumentation/split-compares-pass.so.cc @@ -882,7 +882,7 @@ size_t SplitComparesTransform::splitFPCompares(Module &M) { // BUG FIXME TODO: u64 does not work for > 64 bit ... e.g. 80 and 128 bit if (sizeInBits > 64) { continue; } - IntegerType *intType = IntegerType::get(C, op_size); + IntegerType * intType = IntegerType::get(C, op_size); const unsigned int precision = sizeInBits == 32 ? 24 : sizeInBits == 64 ? 53 : sizeInBits == 128 ? 113 @@ -916,13 +916,14 @@ size_t SplitComparesTransform::splitFPCompares(Module &M) { /* create the integers from floats directly */ Instruction *bpre_op0, *bpre_op1; bpre_op0 = CastInst::Create(Instruction::BitCast, op0, - IntegerType::get(C, op_size)); - bb->getInstList().insert(BasicBlock::iterator(bb->getTerminator()), bpre_op0); + IntegerType::get(C, op_size)); + bb->getInstList().insert(BasicBlock::iterator(bb->getTerminator()), + bpre_op0); bpre_op1 = CastInst::Create(Instruction::BitCast, op1, - IntegerType::get(C, op_size)); - bb->getInstList().insert(BasicBlock::iterator(bb->getTerminator()), bpre_op1); - + IntegerType::get(C, op_size)); + bb->getInstList().insert(BasicBlock::iterator(bb->getTerminator()), + bpre_op1); /* Check if any operand is NaN. * If so, all comparisons except unequal (which yields true) yield false */ @@ -940,41 +941,41 @@ size_t SplitComparesTransform::splitFPCompares(Module &M) { /* Check op0 for NaN */ /* Shift left 1 Bit, ignore sign bit */ Instruction *nan_op0, *nan_op1; - nan_op0 = BinaryOperator::Create( - Instruction::Shl, bpre_op0, - ConstantInt::get(bpre_op0->getType(), 1)); - bb->getInstList().insert(BasicBlock::iterator(bb->getTerminator()), nan_op0); + nan_op0 = BinaryOperator::Create(Instruction::Shl, bpre_op0, + ConstantInt::get(bpre_op0->getType(), 1)); + bb->getInstList().insert(BasicBlock::iterator(bb->getTerminator()), + nan_op0); /* compare to NaN interval */ Instruction *is_op0_nan = - CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_UGT, nan_op0, ConstantInt::get(intType, NaN_lowend) ); + CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_UGT, nan_op0, + ConstantInt::get(intType, NaN_lowend)); bb->getInstList().insert(BasicBlock::iterator(bb->getTerminator()), is_op0_nan); /* Check op1 for NaN */ /* Shift right 1 Bit, ignore sign bit */ - nan_op1 = BinaryOperator::Create( - Instruction::Shl, bpre_op1, - ConstantInt::get(bpre_op1->getType(), 1)); - bb->getInstList().insert(BasicBlock::iterator(bb->getTerminator()), nan_op1); + nan_op1 = BinaryOperator::Create(Instruction::Shl, bpre_op1, + ConstantInt::get(bpre_op1->getType(), 1)); + bb->getInstList().insert(BasicBlock::iterator(bb->getTerminator()), + nan_op1); /* compare to NaN interval */ Instruction *is_op1_nan = - CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_UGT, nan_op1, ConstantInt::get(intType, NaN_lowend) ); + CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_UGT, nan_op1, + ConstantInt::get(intType, NaN_lowend)); bb->getInstList().insert(BasicBlock::iterator(bb->getTerminator()), is_op1_nan); /* combine checks */ - Instruction *is_nan = BinaryOperator::Create( - Instruction::Or, is_op0_nan, is_op1_nan); - bb->getInstList().insert(BasicBlock::iterator(bb->getTerminator()), - is_nan); + Instruction *is_nan = + BinaryOperator::Create(Instruction::Or, is_op0_nan, is_op1_nan); + bb->getInstList().insert(BasicBlock::iterator(bb->getTerminator()), is_nan); /* the result of the comparison, when at least one op is NaN is true only for the "NOT EQUAL" predicates. */ - bool NaNcmp_result = - FcmpInst->getPredicate() == CmpInst::FCMP_ONE || - FcmpInst->getPredicate() == CmpInst::FCMP_UNE; + bool NaNcmp_result = FcmpInst->getPredicate() == CmpInst::FCMP_ONE || + FcmpInst->getPredicate() == CmpInst::FCMP_UNE; BasicBlock *nonan_bb = BasicBlock::Create(C, "noNaN", end_bb->getParent(), end_bb); @@ -989,24 +990,30 @@ size_t SplitComparesTransform::splitFPCompares(Module &M) { /*** now working in nonan_bb ***/ /* Treat -0.0 as equal to +0.0, that is for -0.0 make it +0.0 */ - Instruction *b_op0, *b_op1; - Instruction *isMzero_op0, *isMzero_op1; + Instruction * b_op0, *b_op1; + Instruction * isMzero_op0, *isMzero_op1; const unsigned long long MinusZero = 1UL << (sizeInBits - 1U); const unsigned long long PlusZero = 0; - isMzero_op0 = - CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_EQ, bpre_op0, ConstantInt::get(intType, MinusZero)); - nonan_bb->getInstList().insert(BasicBlock::iterator(nonan_bb->getTerminator()), isMzero_op0); + isMzero_op0 = CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_EQ, bpre_op0, + ConstantInt::get(intType, MinusZero)); + nonan_bb->getInstList().insert( + BasicBlock::iterator(nonan_bb->getTerminator()), isMzero_op0); - isMzero_op1 = - CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_EQ, bpre_op1, ConstantInt::get(intType, MinusZero)); - nonan_bb->getInstList().insert(BasicBlock::iterator(nonan_bb->getTerminator()), isMzero_op1); + isMzero_op1 = CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_EQ, bpre_op1, + ConstantInt::get(intType, MinusZero)); + nonan_bb->getInstList().insert( + BasicBlock::iterator(nonan_bb->getTerminator()), isMzero_op1); - b_op0 = SelectInst::Create(isMzero_op0, ConstantInt::get(intType, PlusZero), bpre_op0); - nonan_bb->getInstList().insert(BasicBlock::iterator(nonan_bb->getTerminator()), b_op0); + b_op0 = SelectInst::Create(isMzero_op0, ConstantInt::get(intType, PlusZero), + bpre_op0); + nonan_bb->getInstList().insert( + BasicBlock::iterator(nonan_bb->getTerminator()), b_op0); - b_op1 = SelectInst::Create(isMzero_op1, ConstantInt::get(intType, PlusZero), bpre_op1); - nonan_bb->getInstList().insert(BasicBlock::iterator(nonan_bb->getTerminator()), b_op1); + b_op1 = SelectInst::Create(isMzero_op1, ConstantInt::get(intType, PlusZero), + bpre_op1); + nonan_bb->getInstList().insert( + BasicBlock::iterator(nonan_bb->getTerminator()), b_op1); /* isolate signs of value of floating point type */ @@ -1017,22 +1024,26 @@ size_t SplitComparesTransform::splitFPCompares(Module &M) { s_s0 = BinaryOperator::Create(Instruction::LShr, b_op0, ConstantInt::get(b_op0->getType(), op_size - 1)); - nonan_bb->getInstList().insert(BasicBlock::iterator(nonan_bb->getTerminator()), s_s0); + nonan_bb->getInstList().insert( + BasicBlock::iterator(nonan_bb->getTerminator()), s_s0); t_s0 = new TruncInst(s_s0, Int1Ty); - nonan_bb->getInstList().insert(BasicBlock::iterator(nonan_bb->getTerminator()), t_s0); + nonan_bb->getInstList().insert( + BasicBlock::iterator(nonan_bb->getTerminator()), t_s0); s_s1 = BinaryOperator::Create(Instruction::LShr, b_op1, ConstantInt::get(b_op1->getType(), op_size - 1)); - nonan_bb->getInstList().insert(BasicBlock::iterator(nonan_bb->getTerminator()), s_s1); + nonan_bb->getInstList().insert( + BasicBlock::iterator(nonan_bb->getTerminator()), s_s1); t_s1 = new TruncInst(s_s1, Int1Ty); - nonan_bb->getInstList().insert(BasicBlock::iterator(nonan_bb->getTerminator()), t_s1); + nonan_bb->getInstList().insert( + BasicBlock::iterator(nonan_bb->getTerminator()), t_s1); /* compare of the sign bits */ icmp_sign_bit = CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_EQ, t_s0, t_s1); - nonan_bb->getInstList().insert(BasicBlock::iterator(nonan_bb->getTerminator()), - icmp_sign_bit); + nonan_bb->getInstList().insert( + BasicBlock::iterator(nonan_bb->getTerminator()), icmp_sign_bit); /* create a new basic block which is executed if the signedness bits are * equal */ @@ -1440,8 +1451,8 @@ bool SplitComparesTransform::runOnModule(Module &M) { if (!be_quiet && !debug) { - errs() << "Split-floatingpoint-compare-pass: " << count - << " FP comparisons splitted\n"; + errs() << "Split-floatingpoint-compare-pass: " << count + << " FP comparisons splitted\n"; } diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c index 3a0e0801..e4b83fa5 100644 --- a/src/afl-fuzz-init.c +++ b/src/afl-fuzz-init.c @@ -920,7 +920,7 @@ void perform_dry_run(afl_state_t *afl) { q->was_fuzzed = 1; --afl->pending_not_fuzzed; - --afl->active_paths; + --afl->active_items; } @@ -1051,7 +1051,7 @@ void perform_dry_run(afl_state_t *afl) { q->was_fuzzed = 1; --afl->pending_not_fuzzed; - --afl->active_paths; + --afl->active_items; } @@ -1162,7 +1162,7 @@ void perform_dry_run(afl_state_t *afl) { p->was_fuzzed = 1; --afl->pending_not_fuzzed; - --afl->active_paths; + --afl->active_items; } @@ -1175,7 +1175,7 @@ void perform_dry_run(afl_state_t *afl) { q->was_fuzzed = 1; --afl->pending_not_fuzzed; - --afl->active_paths; + --afl->active_items; } diff --git a/src/afl-fuzz-one.c b/src/afl-fuzz-one.c index ebf3f4ac..426a6507 100644 --- a/src/afl-fuzz-one.c +++ b/src/afl-fuzz-one.c @@ -547,7 +547,7 @@ u8 fuzz_one_original(afl_state_t *afl) { afl->queue_cur->perf_score = orig_perf = perf_score = calculate_score(afl, afl->queue_cur); - if (unlikely(perf_score <= 0 && afl->active_paths > 1)) { + if (unlikely(perf_score <= 0 && afl->active_items > 1)) { goto abandon_entry; @@ -3064,7 +3064,7 @@ static u8 mopt_common_fuzzing(afl_state_t *afl, MOpt_globals_t MOpt_globals) { else orig_perf = perf_score = calculate_score(afl, afl->queue_cur); - if (unlikely(perf_score <= 0 && afl->active_paths > 1)) { + if (unlikely(perf_score <= 0 && afl->active_items > 1)) { goto abandon_entry; diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c index fd5610ca..2d76e4d2 100644 --- a/src/afl-fuzz-queue.c +++ b/src/afl-fuzz-queue.c @@ -548,7 +548,7 @@ void add_to_queue(afl_state_t *afl, u8 *fname, u32 len, u8 passed_det) { if (likely(q->len > 4)) afl->ready_for_splicing_count++; ++afl->queued_items; - ++afl->active_paths; + ++afl->active_items; ++afl->pending_not_fuzzed; afl->cycles_wo_finds = 0; diff --git a/src/afl-fuzz-redqueen.c b/src/afl-fuzz-redqueen.c index 240bd708..e363dffd 100644 --- a/src/afl-fuzz-redqueen.c +++ b/src/afl-fuzz-redqueen.c @@ -461,7 +461,7 @@ static u8 colorization(afl_state_t *afl, u8 *buf, u32 len, if (afl->colorize_success && afl->cmplog_lvl < 3 && (positions > CMPLOG_POSITIONS_MAX && len / positions == 1 && - afl->active_paths / afl->colorize_success > CMPLOG_CORPUS_PERCENT)) { + afl->active_items / afl->colorize_success > CMPLOG_CORPUS_PERCENT)) { #ifdef _DEBUG fprintf(stderr, "Colorization unsatisfactory\n"); diff --git a/test/test-cmplog.c b/test/test-cmplog.c index 262df6bd..1a314653 100644 --- a/test/test-cmplog.c +++ b/test/test-cmplog.c @@ -7,6 +7,7 @@ #include <unistd.h> int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t i) { + if (i < 24) return 0; if (buf[0] != 'A') return 0; if (buf[1] != 'B') return 0; @@ -16,17 +17,25 @@ int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t i) { if (strncmp(buf + 12, "IJKL", 4) == 0 && strcmp(buf + 16, "DEADBEEF") == 0) abort(); return 0; + } #ifdef __AFL_COMPILER int main(int argc, char *argv[]) { - unsigned char buf[1024]; - ssize_t i; - while(__AFL_LOOP(1000)) { - i = read(0, (char*)buf, sizeof(buf) - 1); + + unsigned char buf[1024]; + ssize_t i; + while (__AFL_LOOP(1000)) { + + i = read(0, (char *)buf, sizeof(buf) - 1); if (i > 0) buf[i] = 0; LLVMFuzzerTestOneInput(buf, i); + } + return 0; + } + #endif + diff --git a/test/test-fp_Infcases.c b/test/test-fp_Infcases.c index 88a89ead..458202d6 100644 --- a/test/test-fp_Infcases.c +++ b/test/test-fp_Infcases.c @@ -6,23 +6,23 @@ #include <assert.h> #define _GNU_SOURCE -#include <math.h> /* for NaNs and infinity values */ +#include <math.h> /* for NaNs and infinity values */ int main() { volatile FLOAT_TYPE a, b; #ifdef INFINITY - FLOAT_TYPE inf = (FLOAT_TYPE) INFINITY; + FLOAT_TYPE inf = (FLOAT_TYPE)INFINITY; #else - FLOAT_TYPE inf = 1.0 / 0.0; /* produces infinity */ + FLOAT_TYPE inf = 1.0 / 0.0; /* produces infinity */ #endif FLOAT_TYPE negZero = 1.0 / -inf; FLOAT_TYPE posZero = 0.0; /* plus infinity */ - a = (1.0 / 0.0); /* positive infinity */ - b = (1.0 / 0.0); /* positive infinity */ + a = (1.0 / 0.0); /* positive infinity */ + b = (1.0 / 0.0); /* positive infinity */ assert(!(a < b)); assert((a <= b)); assert(!(a > b)); @@ -30,7 +30,7 @@ int main() { assert(!(a != b)); assert((a == b)); - b = -(1.0 / 0.0); /* negative infinity */ + b = -(1.0 / 0.0); /* negative infinity */ assert(!(a < b)); assert(!(a <= b)); assert((a > b)); @@ -38,7 +38,7 @@ int main() { assert((a != b)); assert(!(a == b)); - b = 1.0 / -(1.0 / 0.0); /* negative 0 */ + b = 1.0 / -(1.0 / 0.0); /* negative 0 */ assert(!(a < b)); assert(!(a <= b)); assert((a > b)); @@ -46,7 +46,7 @@ int main() { assert((a != b)); assert(!(a == b)); - b = 0.0; /* positive 0 */ + b = 0.0; /* positive 0 */ assert(!(a < b)); assert(!(a <= b)); assert((a > b)); @@ -71,8 +71,8 @@ int main() { assert(!(a == b)); /* negative infinity */ - a = -(1.0 / 0.0); - b = (1.0 / 0.0); /* positive infinity */ + a = -(1.0 / 0.0); + b = (1.0 / 0.0); /* positive infinity */ assert((a < b)); assert((a <= b)); assert(!(a > b)); @@ -80,7 +80,7 @@ int main() { assert((a != b)); assert(!(a == b)); - b = -(1.0 / 0.0); /* negative infinity */ + b = -(1.0 / 0.0); /* negative infinity */ assert(!(a < b)); assert((a <= b)); assert(!(a > b)); @@ -88,7 +88,7 @@ int main() { assert(!(a != b)); assert((a == b)); - b = 1.0 / -(1.0 / 0.0); /* negative 0 */ + b = 1.0 / -(1.0 / 0.0); /* negative 0 */ assert((a < b)); assert((a <= b)); assert(!(a > b)); @@ -96,7 +96,7 @@ int main() { assert((a != b)); assert(!(a == b)); - b = 0.0; /* positive 0 */ + b = 0.0; /* positive 0 */ assert((a < b)); assert((a <= b)); assert(!(a > b)); diff --git a/test/test-fp_NaNcases.c b/test/test-fp_NaNcases.c index 78d32711..94a0ff71 100644 --- a/test/test-fp_NaNcases.c +++ b/test/test-fp_NaNcases.c @@ -6,7 +6,7 @@ #include <assert.h> #define _GNU_SOURCE -#include <math.h> /* for NaNs and infinity values */ +#include <math.h> /* for NaNs and infinity values */ int main() { @@ -14,14 +14,14 @@ int main() { /* NaN */ #ifdef NAN - a = (FLOAT_TYPE) NAN; /* produces NaN */ + a = (FLOAT_TYPE)NAN; /* produces NaN */ #else - a = 0.0 / 0.0; /* produces NaN */ + a = 0.0 / 0.0; /* produces NaN */ #endif #ifdef INFINITY - FLOAT_TYPE inf = (FLOAT_TYPE) INFINITY; + FLOAT_TYPE inf = (FLOAT_TYPE)INFINITY; #else - FLOAT_TYPE inf = 1.0 / 0.0; /* produces infinity */ + FLOAT_TYPE inf = 1.0 / 0.0; /* produces infinity */ #endif FLOAT_TYPE negZero = 1.0 / -inf; FLOAT_TYPE posZero = 0.0; @@ -42,7 +42,7 @@ int main() { assert((a != b)); assert(!(a == b)); - b = 1.0 / -(1.0 / 0.0); /* negative 0 */ + b = 1.0 / -(1.0 / 0.0); /* negative 0 */ assert(!(a < b)); assert(!(a <= b)); assert(!(a > b)); @@ -66,7 +66,7 @@ int main() { assert((a != b)); assert(!(a == b)); - b = (1.0 / 0.0); /* positive infinity */ + b = (1.0 / 0.0); /* positive infinity */ assert(!(a < b)); assert(!(a <= b)); assert(!(a > b)); @@ -74,7 +74,7 @@ int main() { assert((a != b)); assert(!(a == b)); - b = -(1.0 / 0.0); /* negative infinity */ + b = -(1.0 / 0.0); /* negative infinity */ assert(!(a < b)); assert(!(a <= b)); assert(!(a > b)); diff --git a/test/test-fp_minusZerocases.c b/test/test-fp_minusZerocases.c index 00beef2e..f821f2ab 100644 --- a/test/test-fp_minusZerocases.c +++ b/test/test-fp_minusZerocases.c @@ -6,15 +6,15 @@ #include <assert.h> #define _GNU_SOURCE -#include <math.h> /* for NaNs and infinity values */ +#include <math.h> /* for NaNs and infinity values */ int main() { volatile FLOAT_TYPE a, b; /* negative zero */ - a = 1.0 / -(1.0 / 0.0); /* negative 0 */ - b = 0.0; /* positive 0 */ + a = 1.0 / -(1.0 / 0.0); /* negative 0 */ + b = 0.0; /* positive 0 */ assert(!(a < b)); assert((a <= b)); assert(!(a > b)); @@ -22,8 +22,8 @@ int main() { assert(!(a != b)); assert((a == b)); - a = 1.0 / -(1.0 / 0.0); /* negative 0 */ - b = 1.0 / -(1.0 / 0.0); /* negative 0 */ + a = 1.0 / -(1.0 / 0.0); /* negative 0 */ + b = 1.0 / -(1.0 / 0.0); /* negative 0 */ assert(!(a < b)); assert((a <= b)); assert(!(a > b)); diff --git a/utils/libtokencap/libtokencap.so.c b/utils/libtokencap/libtokencap.so.c index 2b1e3903..0db044a1 100644 --- a/utils/libtokencap/libtokencap.so.c +++ b/utils/libtokencap/libtokencap.so.c @@ -171,7 +171,7 @@ static void __tokencap_load_mappings(void) { int mib[] = {CTL_VM, VM_PROC, VM_PROC_MAP, __tokencap_pid, sizeof(struct kinfo_vmentry)}; #endif - char *buf, *low, *high; + char * buf, *low, *high; size_t miblen = sizeof(mib) / sizeof(mib[0]); size_t len; @@ -345,11 +345,7 @@ static void __tokencap_dump(const u8 *ptr, size_t len, u8 is_text) { wrt_ok &= (pos == write(__tokencap_out_file, buf, pos)); wrt_ok &= (2 == write(__tokencap_out_file, "\"\n", 2)); - if (!wrt_ok) { - - DEBUGF("%s", "writing to the token file failed\n"); - - } + if (!wrt_ok) { DEBUGF("%s", "writing to the token file failed\n"); } } |