aboutsummaryrefslogtreecommitdiffstats
path: root/test/testFuncs2.c
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2016-12-25 19:43:36 +0000
committerbloodstalker <thabogre@gmail.com>2016-12-25 19:43:36 +0000
commite0490244850b11f395aec7e1605a2fc2eab691a7 (patch)
treeaffeb63b1eba374219658d22d52f72e64c956bd6 /test/testFuncs2.c
parentadded updates for mutator.sh (diff)
downloadmutator-e0490244850b11f395aec7e1605a2fc2eab691a7.tar.gz
mutator-e0490244850b11f395aec7e1605a2fc2eab691a7.zip
updated
Diffstat (limited to 'test/testFuncs2.c')
-rw-r--r--test/testFuncs2.c26
1 files changed, 25 insertions, 1 deletions
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;