crypto2011/IDR

Bug: infinite loop inside "AnalyzeArguments.cpp"

renan-r-santos opened this issue · 1 comments

Hi @crypto2011
First of all, thank you for your amazing work!
I've being working on a file that is apparently triggering an infinite loop (the analysis never ends even when I wait 2 days for it).
Debugging the issue, I've found that it happens inside the file Threads.cpp, specifically at the function below, when the variable "adr" equals to the address 0x0053AB40 (I hope this info can help you debug the issue)

void __fastcall TAnalyzeThread::AnalyzeCode2(bool args)
{
    PUnitRec    recU;

    int stepMask = StartProgress(CodeSize, "Analyzing step 2...");

    //EP
    mainForm->AnalyzeProc(2, EP);

    for (int n = 0; n < CodeSize && !Terminated; n++)
    {
        if ((n & stepMask) == 0) UpdateProgress();
        if (IsFlagSet(cfProcStart, n))
        {
            DWORD adr = Pos2Adr(n);
            UpdateAddrInStatusBar(adr);
            if (args) mainForm->AnalyzeArguments(adr);
            mainForm->AnalyzeProc(2, adr);
        }
    }
    StopProgress();
}

Unfortunately, I couldn't fully understand and fix the issue. I think it is something related to the function AnalyzeArguments calling itself several times but I'm not sure. Since the file is bigger than 10MB, I uploaded it to my gDrive (link is below). I'm using the 2014 knowledge base file, by the way.

File analysed: file.zip

I really appreciate your help
Thanks!

@crypto2011 Additional information:

Info 1 - I managed to run a complete analysis by commenting out all 3 calls to AnalyzeCode2 in "Threads.cpp" (lines 141, 150, 159). This means that AnalyzeCode2 is the only problem here that needs a fix.

Info 2 - I managed to run a complete analysis using an old version of IDR (2.5.3 beta, kb2010). I don't know the differences to the current version, however the result was far from good. "Info 1" produced much better results