Skip to content

Commit

Permalink
version used for fuzzing - time is wrapped with deterministic version…
Browse files Browse the repository at this point in the history
… and sanitizers used
  • Loading branch information
panstromek committed Feb 20, 2022
1 parent 8a78b63 commit beee176
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ TUNE8DBS_EXE = tune8dbs

# --- Libraries

LDFLAGS = -static -lm -lz
LDFLAGS = -lm -lz -Wl,--wrap=time
#LDFLAGS = -static -lm -lz -Wl,-Map,map.out


Expand All @@ -125,7 +125,7 @@ CXX = g++
DEFS = -DINCLUDE_BOOKTOOL -DTEXT_BASED -DZLIB_STATIC

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

CFLAGS = $(OPTS) $(WARNINGS) $(DEFS)
Expand Down
1 change: 1 addition & 0 deletions booktool.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/


#include "wrap_time.h"

#include <stdio.h>
#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions enddev.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Contents:
*/

#include "wrap_time.h"


#include <assert.h>
Expand Down
2 changes: 1 addition & 1 deletion practice.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Contents: A small utility which enables the user to browse
an opening book file.
*/

#include "wrap_time.h"

#include <stdio.h>
#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions tune8dbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
errors.
*/

#include "wrap_time.h"

#include <math.h>
#include <stdio.h>
Expand Down
14 changes: 14 additions & 0 deletions wrap_time.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef WRAP_TIME_H
#define WRAP_TIME_H

long __wrap_time(long *__timer) {
static long time = 100;
time += 1;
long result = time / 100;
if (__timer != 0) {
*__timer = result;
}
return result;
}

#endif // WRAP_TIME_H
1 change: 1 addition & 0 deletions zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@



#include "wrap_time.h"
#include <ctype.h>
#include <math.h>
#include <stdio.h>
Expand Down

0 comments on commit beee176

Please sign in to comment.