It's UB to have a call to va_start without a corresponding call to va_end#51
Open
camel-cdr wants to merge 1 commit intorui314:mainfrom
camel-cdr:main
Open
It's UB to have a call to va_start without a corresponding call to va_end#51camel-cdr wants to merge 1 commit intorui314:mainfrom camel-cdr:main
camel-cdr wants to merge 1 commit intorui314:mainfrom
camel-cdr:main
Conversation
Author
|
I just realized that fixing this will be a bit more involved, as early versions of static void verror_at(char *loc, char *fmt, va_list ap) {
int pos = loc - current_input;
fprintf(stderr, "%s\n", current_input);
fprintf(stderr, "%*s", pos, ""); // print pos spaces.
fprintf(stderr, "^ ");
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
exit(1);
}
static void error_at(char *loc, char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
verror_at(loc, fmt, ap);
va_end(ap, fmt); // <- new addition
}I think that (The effort this would take might not be worth it though) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is just a tiny nitpick, but Annex J says:
So its technically UB, even if you call
exit(). This will probably not cause any problems, but it might be worth having the code be more compliant.(Also thanks for the amazing project!)