Skip to content

Commit beee176

Browse files
committed
version used for fuzzing - time is wrapped with deterministic version and sanitizers used
1 parent 8a78b63 commit beee176

File tree

7 files changed

+21
-3
lines changed

7 files changed

+21
-3
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ TUNE8DBS_EXE = tune8dbs
109109

110110
# --- Libraries
111111

112-
LDFLAGS = -static -lm -lz
112+
LDFLAGS = -lm -lz -Wl,--wrap=time
113113
#LDFLAGS = -static -lm -lz -Wl,-Map,map.out
114114

115115

@@ -125,7 +125,7 @@ CXX = g++
125125
DEFS = -DINCLUDE_BOOKTOOL -DTEXT_BASED -DZLIB_STATIC
126126

127127
WARNINGS = -Wall -Wcast-align -Wwrite-strings -Wstrict-prototypes -Winline
128-
OPTS = -O4 -s -fomit-frame-pointer -falign-functions=32
128+
OPTS = -O4 -g -fsanitize=address,undefined -static-libasan -fno-omit-frame-pointer
129129
#OPTS = -O4 -s -fomit-frame-pointer -mtune=core2 -falign-functions=32
130130

131131
CFLAGS = $(OPTS) $(WARNINGS) $(DEFS)

booktool.c

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212

1313

14+
#include "wrap_time.h"
1415

1516
#include <stdio.h>
1617
#include <stdlib.h>

enddev.c

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
Contents:
1111
*/
1212

13+
#include "wrap_time.h"
1314

1415

1516
#include <assert.h>

practice.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Contents: A small utility which enables the user to browse
1111
an opening book file.
1212
*/
13-
13+
#include "wrap_time.h"
1414

1515
#include <stdio.h>
1616
#include <stdlib.h>

tune8dbs.c

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
errors.
1414
*/
1515

16+
#include "wrap_time.h"
1617

1718
#include <math.h>
1819
#include <stdio.h>

wrap_time.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef WRAP_TIME_H
2+
#define WRAP_TIME_H
3+
4+
long __wrap_time(long *__timer) {
5+
static long time = 100;
6+
time += 1;
7+
long result = time / 100;
8+
if (__timer != 0) {
9+
*__timer = result;
10+
}
11+
return result;
12+
}
13+
14+
#endif // WRAP_TIME_H

zebra.c

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313

1414

15+
#include "wrap_time.h"
1516
#include <ctype.h>
1617
#include <math.h>
1718
#include <stdio.h>

0 commit comments

Comments
 (0)