42School / norminette

Official 42 norminette
MIT License
926 stars 138 forks source link

Way of bypassing all norm check (except line too long) #474

Closed matubu closed 7 months ago

matubu commented 8 months ago

Describe the bug Using a \ followed by a newline in the comment delimiter prevents the norminette from recognizing the end of the comment. Consequently, the norminette interprets the entire file as commented out.

Erroneous code

/* *\
/

#include <stdio.h>

int main() {
  for (int i=0; i<2;++i)
    printf("%d\n", i);
}

/**/
$ norminette test.c
test.c: OK!
$ gcc test.c 
$ ./a.out 
0
1

Additional infos

Additional context You could also use a trigraph, making the issue harder to detect.

/* *??/
/

#include <stdio.h>

int main() {
  for (int i=0; i<2;++i)
    printf("%d\n", i);
}

/**/

Also, since the norminette never sees anything other than a comment, it does not check if the header is valid.