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

Uninitialized variables in TTCCLayout #148

Closed
supermassive opened this issue Mar 1, 2016 · 1 comment
Closed

Uninitialized variables in TTCCLayout #148

supermassive opened this issue Mar 1, 2016 · 1 comment
Assignees
Labels

Comments

@supermassive
Copy link

Hello,
There is a difference in TTCCLayout definitions between 1.2.x and master branches:
https://github.com/log4cplus/log4cplus/blob/1.2.x/include/log4cplus/layout.h#L187-L190

       bool use_gmtime;
       bool thread_printing;
       bool category_prefixing;
       bool context_printing;

https://github.com/log4cplus/log4cplus/blob/master/include/log4cplus/layout.h#L188-L191

       bool use_gmtime = false;
       bool thread_printing = true;
       bool category_prefixing = true;
       bool context_printing = true;

As the result in 1.2.x when TTCCLayout is initialized by that ctor:

TTCCLayout::TTCCLayout(const log4cplus::helpers::Properties& properties)
    : Layout(properties)
    , dateFormat(properties.getProperty (LOG4CPLUS_TEXT("DateFormat"),
            internal::empty_str))
{
    properties.getBool (use_gmtime, LOG4CPLUS_TEXT("Use_gmtime"));
    properties.getBool (thread_printing, LOG4CPLUS_TEXT("ThreadPrinting"));
    properties.getBool (category_prefixing, LOG4CPLUS_TEXT("CategoryPrefixing"));
    properties.getBool (context_printing, LOG4CPLUS_TEXT("ContextPrinting"));
}

these 4 bools may remain uninitialized in release mode

Upd: VS 2015(update 1), x86, Release.

wilx added a commit to wilx/log4cplus that referenced this issue Mar 2, 2016
TTCCLayotu boolean members could be left uninitialized. Initialize them.
@wilx wilx self-assigned this Mar 2, 2016
@wilx wilx added the bug label Mar 2, 2016
wilx added a commit to wilx/log4cplus that referenced this issue Mar 2, 2016
TTCCLayotu boolean members could be left uninitialized. Initialize them.
wilx added a commit to wilx/log4cplus that referenced this issue Mar 2, 2016
TTCCLayotu boolean members could be left uninitialized. Initialize them.
wilx added a commit that referenced this issue Mar 2, 2016
@wilx
Copy link
Contributor

wilx commented Mar 2, 2016

Thank you for the report. This is now fixed on 1.2.x by merge #149.

@wilx wilx closed this as completed Mar 2, 2016
ljx0305 added a commit to ljx0305/log4cplus that referenced this issue Mar 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants