Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
matubu opened this issue Dec 31, 2023 · 0 comments · Fixed by #486
Closed

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

matubu opened this issue Dec 31, 2023 · 0 comments · Fixed by #486
Labels
bug Something isn't working

Comments

@matubu
Copy link

matubu commented Dec 31, 2023

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

  • OS: Ubuntu 22.04.1
  • python3 --version: Python 3.10.12
  • norminette -v: norminette 3.3.55

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.

@matubu matubu changed the title ay of bypassing all norm check (exept line too long) Way of bypassing all norm check (except line too long) Dec 31, 2023
@matthieu42Network matthieu42Network added the bug Something isn't working label Jan 2, 2024
NiumXp added a commit to NiumXp/norminette that referenced this issue Jan 25, 2024
NiumXp added a commit to NiumXp/norminette that referenced this issue Jan 25, 2024
NiumXp added a commit to NiumXp/norminette that referenced this issue Feb 3, 2024
matthieu42Network pushed a commit that referenced this issue Feb 7, 2024
* feat: add to translate (di|tri)graphs in Lexer, fix #474

* add tests for code showed in #474 issue

* add a test for multiple lines with backslash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants