Skip to content

Commit 5ad8b96

Browse files
committed
code format
1 parent 0d66550 commit 5ad8b96

File tree

3 files changed

+37
-13
lines changed

3 files changed

+37
-13
lines changed

include/afl-mutations.h

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,10 +2420,11 @@ inline u32 afl_mutate(afl_state_t *afl, u8 *buf, u32 len, u32 steps,
24202420
s64 val = buf[off] - '0';
24212421
for (u32 i = off + 1; i < off2; ++i) {
24222422

2423-
u8 digit = buf[i] - '0';
2423+
u8 digit = buf[i] - '0';
24242424
s64 valx10;
24252425

2426-
if (val > INT64_MAX/10 || (valx10 = (val * 10)) > INT64_MAX - digit) {
2426+
if (val > INT64_MAX / 10 ||
2427+
(valx10 = (val * 10)) > INT64_MAX - digit) {
24272428

24282429
off2 = i;
24292430
break;
@@ -2440,24 +2441,33 @@ inline u32 afl_mutate(afl_state_t *afl, u8 *buf, u32 len, u32 steps,
24402441
switch (strat) {
24412442

24422443
case 0:
2443-
if (val == INT64_MAX){
2444+
if (val == INT64_MAX) {
2445+
24442446
val /= 10;
24452447
--off2;
2448+
24462449
}
2450+
24472451
val++;
24482452
break;
24492453
case 1:
2450-
if (val == INT64_MIN){
2454+
if (val == INT64_MIN) {
2455+
24512456
val /= 10;
24522457
--off2;
2458+
24532459
}
2460+
24542461
val--;
24552462
break;
24562463
case 2:
2457-
if (val > INT64_MAX/2 || val < INT64_MIN/2) {
2464+
if (val > INT64_MAX / 2 || val < INT64_MIN / 2) {
2465+
24582466
val /= 10;
24592467
--off2;
2468+
24602469
}
2470+
24612471
val *= 2;
24622472
break;
24632473
case 3:
@@ -2476,17 +2486,23 @@ inline u32 afl_mutate(afl_state_t *afl, u8 *buf, u32 len, u32 steps,
24762486

24772487
break;
24782488
case 5:
2479-
if (val > INT64_MAX - 256){
2489+
if (val > INT64_MAX - 256) {
2490+
24802491
val /= 10;
24812492
--off2;
2493+
24822494
}
2495+
24832496
val += rand_below(afl, 256);
24842497
break;
24852498
case 6:
2486-
if (val < INT64_MIN + 256){
2499+
if (val < INT64_MIN + 256) {
2500+
24872501
val /= 10;
24882502
--off2;
2503+
24892504
}
2505+
24902506
val -= rand_below(afl, 256);
24912507
break;
24922508
case 7:
@@ -2506,7 +2522,11 @@ inline u32 afl_mutate(afl_state_t *afl, u8 *buf, u32 len, u32 steps,
25062522

25072523
} else {
25082524

2509-
if (unlikely(off + new_len + len - off2 > max_len)) { goto retry_havoc_step; }
2525+
if (unlikely(off + new_len + len - off2 > max_len)) {
2526+
2527+
goto retry_havoc_step;
2528+
2529+
}
25102530

25112531
/* Head */
25122532

include/types.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ typedef int128_t s128;
188188
\
189189
u8 *d = (u8 *)(_d) + (_o); \
190190
u16 x = _x; \
191-
d[0] = x & 0xFF; x >>= 8; \
191+
d[0] = x & 0xFF; \
192+
x >>= 8; \
192193
d[1] = x & 0xFF; \
193194
\
194195
}
@@ -198,9 +199,12 @@ typedef int128_t s128;
198199
\
199200
u8 *d = (u8 *)(_d) + (_o); \
200201
u32 x = _x; \
201-
d[0] = x & 0xFF; x >>= 8; \
202-
d[1] = x & 0xFF; x >>= 8; \
203-
d[2] = x & 0xFF; x >>= 8; \
202+
d[0] = x & 0xFF; \
203+
x >>= 8; \
204+
d[1] = x & 0xFF; \
205+
x >>= 8; \
206+
d[2] = x & 0xFF; \
207+
x >>= 8; \
204208
d[3] = x & 0xFF; \
205209
\
206210
}

instrumentation/injection-pass.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ bool InjectionRoutines::hookRtns(Module &M) {
102102
Memcmp, Strcmp, Strncmp;
103103
LLVMContext &C = M.getContext();
104104

105-
Type *VoidTy = Type::getVoidTy(C);
105+
Type *VoidTy = Type::getVoidTy(C);
106106
#if LLVM_MAJOR >= 20
107107
PointerType *i8PtrTy = PointerType::getUnqual(C);
108108
#else

0 commit comments

Comments
 (0)