diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/testFuncs1.h | 4 | ||||
| -rw-r--r-- | test/testFuncs2.c | 26 | ||||
| -rw-r--r-- | test/testFuncs2.h | 4 | 
3 files changed, 30 insertions, 4 deletions
| diff --git a/test/testFuncs1.h b/test/testFuncs1.h index 901d4a6..208fd4b 100644 --- a/test/testFuncs1.h +++ b/test/testFuncs1.h @@ -67,7 +67,7 @@ double yetanotherdoubleinsideaheader;  #endif
  /***********************************************************************************************************/
 -/*all the test function prototypes are here.*/
 +/*all the test functi/*on prototypes are here.*/
  void testFuncStatementsinmple (void);
  void testFuncStatementComplexIf (void);
  void testFuncStatementNotCoverage (void);
 @@ -158,7 +158,7 @@ void testfunc9999(void)    };
    struct s* ps1;
 -  /*these two should not be tagged by 18.1 since they are pointers to an incomplete type. the pointer is a complete type.*/
 +  /*these two should no/*t be tagged by 18.1 since they are pointers to an incomplete type. the pointer is a complete type.*/
    struct s** ps2;
    struct s*** ps3;
 diff --git a/test/testFuncs2.c b/test/testFuncs2.c index bfab434..efe9c8e 100644 --- a/test/testFuncs2.c +++ b/test/testFuncs2.c @@ -76,6 +76,22 @@ typedef gaga incompletearr1;  #if 1  #undef LOCOLUPO  #endif + +#define START 0x8000 +#define END 0xFFFF +#define LEN 0x8000 +#if ((START + LEN) > END) +#if 0 +#error Buffer Overrun +#endif +/* OK because START and LEN are unsigned long */ +#endif +#if (((END - START) - LEN) < 0) +#if 0 +#error Buffer Overrun +#endif +/* Not OK: subtraction result wraps around to 0xFFFFFFFF */ +#endif  /*********************************************************************************************************************/  /*Globals*/  int incompletearr1[]; @@ -135,6 +151,14 @@ static void test33(void)    //MINUS(a);    b = (int)a; + +  /* contrast the above START + LEN with the following */ +  if ((START + LEN) > END) +  { +    //error ("Buffer overrun"); +    /* Not OK: START + LEN wraps around to 0x0000 +    due to unsigned int arithmetic */ +  }  }  void testfunc1(void) @@ -339,7 +363,7 @@ void testfunc14(void)    a = b++;    if ((int)(b + b2))    { -    /*something*/ +    /*somethi/*ng*/    }    a = c; diff --git a/test/testFuncs2.h b/test/testFuncs2.h index 647613a..ede14eb 100644 --- a/test/testFuncs2.h +++ b/test/testFuncs2.h @@ -8,6 +8,8 @@  /*Globals*/  extern int aaaa[]; +extern double badboy; +  extern int eldiablo = 0;  extern int bbbb[] = {1, 2, 3, 4, 5, 6}; @@ -32,7 +34,7 @@ void testFunc4()  testFunc5( void)  {  	//different kind of comment -	///another kind +	///anot/*her kind  	/*this kind*/  	/**that kind*/  } | 
