File tree Expand file tree Collapse file tree 5 files changed +27
-29
lines changed Expand file tree Collapse file tree 5 files changed +27
-29
lines changed Original file line number Diff line number Diff line change @@ -10,19 +10,5 @@ int main()
10
10
assert (A1 [3 ] == 'd' );
11
11
assert (strlen (A1 ) == 4 );
12
12
13
- char A2 [5 ] = {'a' , 'b' , '\0' };
14
- char B2 [3 ] = {'c' , 'd' , '\0' };
15
-
16
- strncat (A2 , B2 , 2 );
17
- assert (A2 [3 ] == 'd' );
18
- assert (strlen (A2 ) == 4 );
19
-
20
- char A3 [5 ] = {'a' , 'b' , '\0' };
21
- char B3 [3 ] = {'c' , 'd' , '\0' };
22
-
23
- strncat (A3 , B3 , 1 );
24
- assert (A3 [3 ] == '\0' );
25
- assert (strlen (A3 ) == 4 ); // expected to fail
26
-
27
13
return 0 ;
28
14
}
Original file line number Diff line number Diff line change 1
1
CORE
2
2
main.c
3
- --unwind 10
4
- ^EXIT=10$
3
+ --unwind 10 --pointer-check --bounds-check
4
+ ^VERIFICATION SUCCESSFUL$
5
+ ^EXIT=0$
5
6
^SIGNAL=0$
6
- ^VERIFICATION FAILED$
7
- \[main.assertion.6\] .* assertion strlen\(A3\) == 4: FAILURE
8
- \*\* 1 of 9 failed
9
7
--
10
8
^warning: ignoring
Original file line number Diff line number Diff line change 3
3
4
4
int main ()
5
5
{
6
- strncat ();
7
- assert (0 );
6
+ char A2 [5 ] = {'a' , 'b' , '\0' };
7
+ char B2 [3 ] = {'c' , 'd' , '\0' };
8
+
9
+ strncat (A2 , B2 , 2 );
10
+ assert (A2 [3 ] == 'd' );
11
+ assert (strlen (A2 ) == 4 );
12
+
13
+ char A3 [5 ] = {'a' , 'b' , '\0' };
14
+ char B3 [3 ] = {'c' , 'd' , '\0' };
15
+
16
+ strncat (A3 , B3 , 1 );
17
+ assert (A3 [3 ] == '\0' );
18
+ assert (strlen (A3 ) == 4 ); // expected to fail
19
+
8
20
return 0 ;
9
21
}
Original file line number Diff line number Diff line change 1
- KNOWNBUG
1
+ CORE
2
2
main.c
3
- --pointer-check --bounds-check
4
- ^EXIT=0 $
3
+ --unwind 10 -- pointer-check --bounds-check
4
+ ^EXIT=10 $
5
5
^SIGNAL=0$
6
- ^VERIFICATION SUCCESSFUL$
6
+ ^VERIFICATION FAILED$
7
+ \[main.assertion.4\] .* assertion strlen\(A3\) == 4: FAILURE
8
+ \*\* 1 of \d+ failed
7
9
--
8
10
^warning: ignoring
Original file line number Diff line number Diff line change @@ -72,7 +72,6 @@ __CPROVER_HIDE:;
72
72
ch = src [j ];
73
73
dst [i ] = ch ;
74
74
}
75
- dst [i ] = '\0' ;
76
75
#endif
77
76
return dst ;
78
77
}
@@ -122,7 +121,8 @@ __CPROVER_HIDE:;
122
121
ch = src [j ];
123
122
dst [i ] = ch ;
124
123
}
125
- dst [i ] = '\0' ;
124
+ if (ch != (char )0 )
125
+ dst [i ] = '\0' ;
126
126
#endif
127
127
return dst ;
128
128
}
@@ -288,7 +288,6 @@ __CPROVER_HIDE:;
288
288
ch = src [j ];
289
289
dst [i ] = ch ;
290
290
}
291
- dst [i ] = '\0' ;
292
291
#endif
293
292
return dst ;
294
293
}
@@ -342,7 +341,8 @@ __CPROVER_HIDE:;
342
341
ch = src [j ];
343
342
dst [i ] = ch ;
344
343
}
345
- dst [i ] = '\0' ;
344
+ if (ch != (char )0 )
345
+ dst [i ] = '\0' ;
346
346
#endif
347
347
return dst ;
348
348
}
You can’t perform that action at this time.
0 commit comments