1 | /*
|
---|
2 | * $Id: ufortify.h 1015 2008-05-12 01:18:01Z stevenhl $
|
---|
3 | *
|
---|
4 | * FILE:
|
---|
5 | * ufortify.h
|
---|
6 | *
|
---|
7 | * DESCRIPTION:
|
---|
8 | * User options for fortify. Changes to this file require fortify.c to be
|
---|
9 | * recompiled, but nothing else.
|
---|
10 | */
|
---|
11 |
|
---|
12 | // 28 Jan 08 SHL
|
---|
13 | #define FORTIFY_STORAGE _export /* storage for public functions */
|
---|
14 |
|
---|
15 | #define FORTIFY_ALIGNMENT sizeof(double) /* Byte alignment of all memory blocks */
|
---|
16 |
|
---|
17 | #define FORTIFY_BEFORE_SIZE 32 /* Bytes to allocate before block */
|
---|
18 | #define FORTIFY_BEFORE_VALUE 0xA3 /* Fill value before block */
|
---|
19 |
|
---|
20 | #define FORTIFY_AFTER_SIZE 32 /* Bytes to allocate after block */
|
---|
21 | #define FORTIFY_AFTER_VALUE 0xA5 /* Fill value after block */
|
---|
22 |
|
---|
23 | #define FORTIFY_FILL_ON_ALLOCATE /* Nuke out malloc'd memory */
|
---|
24 | #define FORTIFY_FILL_ON_ALLOCATE_VALUE 0xA7 /* Value to initialize with */
|
---|
25 |
|
---|
26 | #define FORTIFY_FILL_ON_DEALLOCATE /* free'd memory is cleared */
|
---|
27 | #define FORTIFY_FILL_ON_DEALLOCATE_VALUE 0xA9 /* Value to de-initialize with */
|
---|
28 |
|
---|
29 | #define FORTIFY_FILL_ON_CORRUPTION /* Nuke out corrupted memory */
|
---|
30 |
|
---|
31 | /* #define FORTIFY_CHECK_ALL_MEMORY_ON_ALLOCATE */
|
---|
32 | /* #define FORTIFY_CHECK_ALL_MEMORY_ON_DEALLOCATE */
|
---|
33 | #define FORTIFY_PARANOID_DEALLOCATE
|
---|
34 |
|
---|
35 | /* #define FORTIFY_WARN_ON_ZERO_MALLOC */ /* A debug is issued on a malloc(0) */
|
---|
36 | /* #define FORTIFY_FAIL_ON_ZERO_MALLOC */ /* A malloc(0) will fail */
|
---|
37 |
|
---|
38 | #define FORTIFY_WARN_ON_ALLOCATE_FAIL /* A debug is issued on a failed alloc */
|
---|
39 | #define FORTIFY_WARN_ON_FALSE_FAIL /* See Fortify_SetAllocateFailRate */
|
---|
40 | #define FORTIFY_WARN_ON_SIZE_T_OVERFLOW /* Watch for breaking the 64K limit in */
|
---|
41 | /* some braindead architectures... */
|
---|
42 |
|
---|
43 | #define FORTIFY_TRACK_DEALLOCATED_MEMORY
|
---|
44 | #define FORTIFY_DEALLOCATED_MEMORY_LIMIT 1048576 /* Maximum amount of deallocated bytes to keep */
|
---|
45 | /* #define FORTIFY_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY */
|
---|
46 | /* #define FORTIFY_VERBOSE_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY */
|
---|
47 |
|
---|
48 | /* #define FORTIFY_NO_PERCENT_P */ /* sprintf() doesn't support %p */
|
---|
49 | #define FORTIFY_STRDUP /* if you use non-ANSI strdup() */
|
---|
50 |
|
---|
51 | // #include "_malloc.h"
|
---|
52 | #ifdef __cplusplus
|
---|
53 | extern "C" {
|
---|
54 | #endif
|
---|
55 | #ifdef __BORLANDC__
|
---|
56 | // See bc20\source\rtl\rtlinc\_malloc.h
|
---|
57 | void _RTLENTRY _EXPFUNC _lock_heap (void);
|
---|
58 | void _RTLENTRY _EXPFUNC _unlock_heap(void);
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | #ifdef __WATCOMC__
|
---|
62 | // 05 May 08 SHL
|
---|
63 | // J:\sla_dev2\ow.dev\bld\clib\h\heapacc.h
|
---|
64 | extern void (*_AccessNHeap)( void );
|
---|
65 | extern void (*_ReleaseNHeap)( void );
|
---|
66 | #endif
|
---|
67 | #ifdef __cplusplus
|
---|
68 | }
|
---|
69 | #endif
|
---|
70 |
|
---|
71 | #ifdef __BORLANDC__
|
---|
72 | #define FORTIFY_LOCK() _lock_heap() // 28 Jan 08 SHL
|
---|
73 | #define FORTIFY_UNLOCK() _unlock_heap() // 28 Jan 08 SHL
|
---|
74 | #endif
|
---|
75 | #ifdef __WATCOMC__
|
---|
76 | #define FORTIFY_LOCK() _AccessNHeap() // 05 May 08 SHL
|
---|
77 | #define FORTIFY_UNLOCK() _ReleaseNHeap() // 05 May 08 SHL
|
---|
78 | #endif
|
---|
79 |
|
---|
80 | #define FORTIFY_DELETE_STACK_SIZE 256
|
---|
81 |
|
---|
82 | #ifdef __cplusplus /* C++ only options go here */
|
---|
83 |
|
---|
84 | /* #define FORTIFY_PROVIDE_ARRAY_NEW */
|
---|
85 | /* #define FORTIFY_PROVIDE_ARRAY_DELETE */
|
---|
86 |
|
---|
87 | /* #define FORTIFY_AUTOMATIC_LOG_FILE */
|
---|
88 | #define FORTIFY_LOG_FILENAME "fortify.log"
|
---|
89 | #include <iostream.h>
|
---|
90 | #define FORTIFY_FIRST_ERROR_FUNCTION cout << "\a\a\aFortify Hit Generated!\n"
|
---|
91 |
|
---|
92 | #endif /* __cplusplus */
|
---|