Skip to content

Commit a2c3f56

Browse files
committed
remove LLVMFuzzerCustomMutator
1 parent bd630e3 commit a2c3f56

File tree

1 file changed

+0
-62
lines changed

1 file changed

+0
-62
lines changed

sapi/fuzzer/fuzzer-bcmath.c

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -120,68 +120,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
120120
return 0;
121121
}
122122

123-
#define BUF_SIZE 128
124-
125-
static inline bool rand_bool() {
126-
return rand() & 1;
127-
}
128-
129-
static inline size_t generate_random_num_fraction(char *buf, size_t len) {
130-
int zeros = rand() % 10;
131-
for (int i = 0; i < zeros; i++) {
132-
buf[len] = '0';
133-
len++;
134-
}
135-
len += snprintf(buf + len, BUF_SIZE - len, "%ld", random());
136-
return len;
137-
}
138-
139-
static inline size_t generate_random_num(char *buf, size_t len) {
140-
if (rand_bool()) {
141-
/* num < 1 */
142-
buf[len] = '0';
143-
buf[len + 1]= '.';
144-
len += 2;
145-
/* fraction */
146-
len = generate_random_num_fraction(buf, len);
147-
} else {
148-
/* integer */
149-
len += snprintf(buf + len, BUF_SIZE - len, "%ld", random());
150-
if (rand_bool()) {
151-
/* fraction */
152-
buf[len] = '.';
153-
len++;
154-
len = generate_random_num_fraction(buf, len);
155-
}
156-
}
157-
158-
return len;
159-
}
160-
161-
size_t LLVMFuzzerCustomMutator(uint8_t *Data, size_t Size, size_t MaxSize, unsigned int Seed) {
162-
char buf[BUF_SIZE];
163-
size_t len = 0;
164-
165-
/* num1 */
166-
len = generate_random_num(buf, len);
167-
buf[len] = ',';
168-
len++;
169-
170-
/* num2 */
171-
len = generate_random_num(buf, len);
172-
buf[len] = ',';
173-
len++;
174-
175-
/* scale */
176-
len += snprintf(buf + len, BUF_SIZE - len, "%d", rand() % 10);
177-
178-
if (len > MaxSize) {
179-
return 0;
180-
}
181-
memcpy(Data, buf, len);
182-
return len;
183-
}
184-
185123
int LLVMFuzzerInitialize(int *argc, char ***argv) {
186124
fuzzer_init_php(NULL);
187125

0 commit comments

Comments
 (0)