Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: BlueHazzard on August 09, 2015, 05:57:46 pm

Title: possible crash candidate
Post by: BlueHazzard on August 09, 2015, 05:57:46 pm
Hi
i have found a possible crash candidate in macrosmanager.cpp:

start from Line 442:
Code
    if (!target)
    {
        if (project)
        {
            // use the currently compiling target
            target = project->GetCurrentlyCompilingTarget();
            // if none,
            if (!target)
                // use the last known active target
                target = project->GetBuildTarget(project->GetActiveBuildTarget());
        }
    }

target can be a nullpointer but is never checked against it, and later:
line 470:
Code
    while (m_RE_Script.Matches(buffer))
    {
        search = m_RE_Script.GetMatch(buffer, 1);
        wxString sc_name(_T("Replace Macro Target: "));
        sc_name.Append(target->GetTitle());
        replace = Manager::Get()->GetScriptingManager()->LoadBufferRedirectOutput(m_RE_Script.GetMatch(buffer, 2),sc_name);
        buffer.Replace(search, replace, false);
    }
it is used.

I work on my sqrat port and get a crash here. I'm still investigating why, but there should be a check for nullptr anyway

greetings
Title: Re: possible crash candidate
Post by: oBFusCATed on August 09, 2015, 06:01:12 pm
Post a patch please or some detailed steps to reproduce, even if it is against your branch.
Title: Re: possible crash candidate
Post by: BlueHazzard on August 10, 2015, 12:16:42 am
mea culpa, i added this code by myself and fixed it now.

greetings