-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Clang ICE: invalid parameter index
on some attributes with invalid indices applied to varargs functions
#61635
Comments
@llvm/issue-subscribers-clang-frontend |
This is a good bug report while the code is invalid we should generate a proper diagnostic like gcc does: https://godbolt.org/z/PrEvnfKK8 This is probably an easy mistake for someone to make if they are using the attribute the first time or typo the index etc On the other hand we don't have the bandwidth for mass submission of fuzzer bugs but carefully curated bug submissions are definitely welcome @AaronBallman do you have additional feedback on this? |
Should be an easy fix, just compare the |
@llvm/issue-subscribers-good-first-issue |
Agreed, this is a good issue to fix (and shouldn't be too challenging).
You nailed it -- if the fuzzer produces code that could be reasonably plausible for a user to write (like this one), then it's a great bug report to file. For implausible code, we'd be fine accepting a patch to fix the issue if it's a crash but would probably not prioritize the bug too highly otherwise. (If the code is borderline, I'd say go ahead and add an issue for it.) |
Thanks for the feedback @shafik, @AaronBallman! I'll endeavor to post useful bugs as I find them, feel free to let me know if they're straying outside of the realm of reports you want. This test case exhibits a similar issue; not sure whether to file a separate bug or just note it here. void __attribute__ ((alloc_size (2, 3))) *test(int i, ...); |
Eh, let's note it here -- it's a semi-distinct issue, but it's the same kind of problem between both attributes (so the fix for one might fix the other, depending on how we decide to address it). Would you mind editing the summary and title though, so it's clear there's two-ish issues here? |
invalid parameter index
on __format_arg__
with invalid index applied to varargs functioninvalid parameter index
on some attributes with invalid indices applied to varargs functions
Hello @tbaederr , what does this mean >
What changes should I make for the comparison? |
That is not the function where the error is reported though. You need to find the place where that happens and check if the given index is greater than the number of parameters. |
The crash emerges from the assertion failing in the getParamType after being called in the above function.
I guess my task is to return a nice warning or error message maybe > |
Where can I find classes and function for creating Warmng or Error messages? |
Even if I compare the Idx and the result of getFunctionOrMethodNumParams(D) in the getFunctionOrMethodParamType function above , I still can't use an assertion since it will cause a crush. |
Yes, you need to do that before the assertion is reached, and from the function that calls |
I am also working on this issue. Can we collaborate? |
Sure. |
From brief investigation it looks like we want the |
Adding posted patch link - https://reviews.llvm.org/D147037 |
This is a fuzzer-generated bug. Feel free to close if you're not interested in such reports. If you would like more reports of fuzzer-generated bugs, let me know and I can post them. I read the bug report guidelines, and did not find information on whether or not fuzzer-generated bugs were welcome.
Clang crashes on this program:
with this message (Godbolt):
This looks like a Clang problem, because it still happens with
-emit-llvm -Xclang -disable-llvm-passes
.I searched like so for duplicates, but didn't find any:
The text was updated successfully, but these errors were encountered: