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

setConsoleTitle strings #50

Open
MangaD opened this issue Oct 5, 2016 · 5 comments
Open

setConsoleTitle strings #50

MangaD opened this issue Oct 5, 2016 · 5 comments

Comments

@MangaD
Copy link

MangaD commented Oct 5, 2016

There is a problem with the setConsoleTitle function. It uses const char * as string parameter for the print function when compiling with C++. This seems to be a problem because when compiling with clang++ and with the flag -fsanitizer=memory, I just get a warning about uninitialized value at the line:
RLUTIL_PRINT(true_title);

So, I'd advise to change the code of that function to:

RLUTIL_INLINE void setConsoleTitle(RLUTIL_STRING_T title) {
#if defined(_WIN32) && !defined(RLUTIL_USE_ANSI)
#ifdef __cplusplus
    SetConsoleTitleA(title.c_str());
#else
    SetConsoleTitleA(title);
#endif
#else
    RLUTIL_PRINT(ANSI_CONSOLE_TITLE_PRE);
    RLUTIL_PRINT(title);
    RLUTIL_PRINT(ANSI_CONSOLE_TITLE_POST);
#endif // defined(_WIN32) && !defined(RLUTIL_USE_ANSI)
}
@nabijaczleweli
Copy link
Contributor

Looks 👍 if it's not a false positive. Submit a PR.

@MangaD
Copy link
Author

MangaD commented Oct 5, 2016

I just checked and I think it is a false positive, sorry.

@nabijaczleweli
Copy link
Contributor

It did seem to be :P

@refi64
Copy link

refi64 commented Oct 5, 2016

@MangaD It could be that whatever you're passing as title has uninitialized bytes or something.

@MangaD
Copy link
Author

MangaD commented Oct 5, 2016

@kirbyfan64 I am inclined to believe that it is related with libstdc++ not being compiled with memory sanitizer, not sure though.

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

No branches or pull requests

3 participants