File tree 1 file changed +7
-14
lines changed
1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -4,26 +4,19 @@ This file tests two bug patterns reported by @DavidKorczynski in https://github.
4
4
5
5
*/
6
6
7
- #include <stdlib.h>
8
7
#include <assert.h>
8
+ #include <stdlib.h> /* for NULL */
9
9
#include "re.h"
10
10
11
- const char * invalid_patterns [] = {
12
- "\\\x01[^\\\xff][^" ,
13
- "\\\x01[^\\\xff][\\" ,
14
- };
15
11
16
-
17
- int main (void )
12
+ int main ()
18
13
{
19
- const size_t npatterns = sizeof ( invalid_patterns )/ sizeof ( * invalid_patterns );
20
- size_t i ;
14
+ /* Test 1: inverted set without a closing ']' */
15
+ assert ( re_compile ( "\\\x01[^\\\xff][^" ) == NULL ) ;
21
16
22
- /* loop through all invalid patterns and assume compilation rejects them (returns NULL) */
23
- for (i = 0U ; i < npatterns ; ++ i )
24
- {
25
- assert (re_compile (invalid_patterns [i ]) == NULL );
17
+ /* Test 2: set with an incomplete escape sequence and without a closing ']' */
18
+ assert (re_compile ("\\\x01[^\\\xff][\\" ) == NULL );
26
19
27
- }
28
20
return 0 ;
29
21
}
22
+
You can’t perform that action at this time.
0 commit comments