Faq
1–What is BugFighter?
It is a Tool to discover C/C++ errors during run time.
2– How it works?
It parses C/C++ source and generates a new compilable source with test code.
3– Why is it compiler independent?
Because it is language based, it uses standard C rules (see point 2).
4– Why is it plattform independent?
See point 3.
5– When should it be used?
During software testing. It helps to discover wrong code.
6– What can it detect?
Wrong index inside arrays, Single and Multidimensional Array.
int x[10];
int y[10][10][10];
int ii;
ii =10; /* or negative, ii = -4, ii = -12345 ...*/
x[ii] = 8;
y[0][ii][0] = 3; /*inside the array, not only on the whole array */
Wrong array index inside structures.
It can detect wrong index regardless if it is contained in a structure.
typedef struct test_s {
char a[10];
char b[10][5];
char c[10];
} TEST;
...
TEST test;
ii = 10; /* or negative, ii = -4, ii = -12345 ... */<
test.a[-1] = 3; /* inside the array, contained in the struct */
test.a[ii] = 6;
test.b[-2][3] = 7; /* inside the array, contained in the struct */
test.b[10][2] = 4;
test.b[0][19] = 4;
test.b[8][-1] = 4;
test.c[-2] = 7; /* inside the array, contained in the struct */
test.c[11] = 4;
Structure can also be allocated dynamically.
TEST *ptest;
ii = 10; /* or negative, ii = -4, ii = -12345 ... */
ptest = (TEST*)malloc(sizeof(TEST));
ptest->a[-1] = 3; /* inside the array, contained in the struct, in dynamic memory */
ptest->a[ii] = 6;
ptest->b[-2][3] = 7; /* inside the array, contained in the struct, in dynamic memory */
ptest->b[10][2] = 4;
ptest->b[0][19] = 4;
ptest->b[8][-1] = 4;
ptest->c[-2] = 7; /* inside the array, contained in the struct, in dynamic memory */
ptest->c[11] = 4;
Null pointers.
int *p;
int **pp;
TEST test;
TEST *ptest;
...
p = NULL;
*p = 1; /* NULL POINTER */
pp = &p;
**pp = 1; /* NULL POINTER */
ptest = &test;
ptest->c[0][19] = 4; /* wrong index inside the array, contained in the struct */
ptest->c[8][-1] = 1; /* wrong index inside the array, contained in the struct */
ptest = NULL;
ptest->c[8][0] = 1; /* NULL POINTER */