-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Do not check string size for printf()'s format string #1538
Conversation
And create String with its original size, without truncation.
Not a language change. Need help with where to add the tests. |
@@ -76,6 +76,14 @@ void SemanticAnalyser::visit(PositionalParameter ¶m) | |||
|
|||
void SemanticAnalyser::visit(String &string) | |||
{ | |||
// Skip check for printf()'s format string (1st argument) and create the string | |||
// with the original size. This is because format string is not part of bpf byte code. | |||
if (func_ == "printf" && func_arg_idx_ == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit of a shame we cannot use is_compiel_time_func
here. I've created #1539 to make that possible.
Thanks!
You generally want to add a test for the pass you modified. So in this case in tests/semantic_analyser.cpp you can extend Could you also run clang format and squash all the commits together? |
Fixed clang-format issue. Working on test now. |
@yzhao1012, can I help you with the tests? This would be good to get this in :) |
It would be great if you can shoulder the task of writing tests. I am not sure what form of collaboration is the best here. It's totally OK to me if you can just copy or rewrite this PR in a new one that you create from scratch. Or you were thinking to give specific instructions on writing tests? |
I was thinking simple something like this
|
How could I run I was reading https://github.com/iovisor/bpftrace/tree/master/tests but could not find the exact instructions on how to run an individual test. |
if you want an individual test you can do |
@yzhao1012 if you don't mind I'll steal this, rebase and add the tests and then get it merged :). Its nice to have |
And create String with its original size, without truncation.
This allows having longer format string in printf() statement,
and does not affect existing functionality.
Checklist
docs/reference_guide.md
CHANGELOG.md