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

VerboseGC Initialized Stanza Print Fix #5806

Merged
merged 1 commit into from
Feb 10, 2021

Conversation

RSalman
Copy link
Contributor

@RSalman RSalman commented Feb 10, 2021

Using printf methods to write to files (e.g omrfile_printf & omrfilestream_printf) is problematic when the output buffer contains a string with specifier characters (e.g %s). In such a case, the format specifiers are intended to be outputted raw to the file rather than evaluated/expanded. printf will treat the string as a format string and attempt to evaluate the specifiers (and crash) whereas the buffer must be printed raw. Currently, printf methods are used when outputting verbose initialized block (string).

When outputting the init block, use the verbose writer's outputString method rather than using

  • omrfilestream_printf for FileLoggingSynchronous Writer
  • omrfile_printf for FileLoggingBuffered Writer

outputString will use omrfile_write_text and just print the raw characters.

Signed-off-by: Salman Rana salman.rana@ibm.com

Using `printf` methods _(e.g `omrfile_printf` & `omrfilestream_printf`)_
to write to files is problematic when the output buffer contains a
string with a specifier character (e.g %s). In such a case, the special
character is intended to be be outputted raw to the file rather than
evaluated/expanded. `printf` will attempt to evaluate the specifiers
whereas the buffer must be printed raw. Currently, `printf` methods are
used when outputting verbose initialized block (string).

When outputting the init block, use the verbose writer's `outputString`
method rather than using
- `omrfilestream_printf` for FileLoggingSynchronous Writer
- `omrfile_printf` for FileLoggingBuffered Writer

`outputString` will use `omrfile_write_text` and just print the raw
characters.

Signed-off-by: Salman Rana <salman.rana@ibm.com>
@RSalman
Copy link
Contributor Author

RSalman commented Feb 10, 2021

cc @amicic @dmitripivkine

Copy link
Contributor

@dmitripivkine dmitripivkine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RSalman
Copy link
Contributor Author

RSalman commented Feb 10, 2021

@fjeremic could you please have a look whenever you have some time. Ideally, we'd like the fix in by the end of day

@fjeremic fjeremic self-assigned this Feb 10, 2021
@fjeremic
Copy link
Contributor

@genie-omr build all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants