-
Notifications
You must be signed in to change notification settings - Fork 737
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
Replace sprintf with snprintf in many places #20474
Conversation
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.
I believe in the compiler files you need to use TR::snprintfTrunc
; @jdmpapin could you confirm? (Something to do with windows and snprintf
not being defined by default).
At call sites where we're really confident that the buffer is large enough, The point of
If we're OK limiting ourselves to versions of the MSVC runtime library that include this change, then plain |
We've moved up to VS2022, and VS2013 and earlier are out of support so I think it's fine. |
3dbe0ac
to
6191097
Compare
I've pushed an update to address the initial review comments. |
Pushed the new updates. |
Jenkins test sanity.functional alinux,amac,win jdk21 |
I'll defer to someone from the JIT team to offer an opinion on the test failure:
|
@cjjdespres any insights about the test failure? |
It looks like the server process terminated prematurely, or incorrectly, at the end of that test - we expect the process to exit with 0 (success) or 143 (SIGTERM + 128). I think exit code 134 is SIGABRT + 128, so something called |
In the console log for the failure, the server stdout/stderr that was dumped was:
I haven't seen that failure before. |
Do we think it is due to this change? |
The only thing I can see that's obviously JITServer-specific is the change in |
Pushed just a rebase. |
Addressed the review comments, but in J9CompilationStrategy.cpp I'm going to effectively set |
Pls re-review. |
Addressed the latest comments. |
443c4a6
to
e5d8ae2
Compare
There is one remaining place that will require a coordinated merge with OMR. Signed-off-by: Peter Shipton <[email protected]>
Can you please elaborate? I see a couple remaining uses of |
The function should be modified to pass in the size of the buffer, which requires an OMR change. Using strcpy() or strcat() isn't any better than using sprintf(), there is no restriction to the buffer size and a buffer overflow could occur. |
It wasn't immediately obvious to me that the second call |
I can remove the sprintf, but will do it in another PR. |
Jenkins test sanity win32 jdk8 |
|
I was hoping to get the benefit of the pickiness of the Microsoft compiler - I'll try locally. |
Jenkins test sanity aix,alinux,amac,osx jdk21 |
My local builds of jdk8 for 32- and 64-bit Windows were successful. |
The AIX failure to get through jdk_security2 is a known issue #19962 The mac failure is sun/security/krb5/auto/RefreshKrb5Config.java which is network related. It shows |
There is one remaining place that will require a coordinated merge with OMR.