IDR icon indicating copy to clipboard operation
IDR copied to clipboard

Bug in InfoProcInfo::AddArg

Open tmcdos opened this issue 9 years ago • 6 comments

In file Infos.cpp, function InfoProcInfo::AddArg(BYTE Tag, int Ofs, int Size, String Name, String TypeDef) does not initialize argInfo->Register - seems like a bug ?

tmcdos avatar Jul 01 '16 16:07 tmcdos

It's not a bug, because this record field (ARGINFO.Register) initialized in file Misc.cpp, function void __fastcall FillArgInfo(int k, BYTE callkind, PARGINFO argInfo, BYTE** p, int* s).

crypto2011 avatar Jul 04 '16 15:07 crypto2011

This is strange - because if I remove argInfo->Register = false; from InfoProcInfo::AddArg then this field takes different non-zero values every time I load an executable and then save the project.

tmcdos avatar Jul 04 '16 15:07 tmcdos

As You mentioned, because argInfo->Register not initialized in InfoProcInfo::AddArg, so it becomes random field. But this field takes the value in function FillArgInfo. But You are right, I need to initialize argInfo->Register.

crypto2011 avatar Jul 05 '16 05:07 crypto2011

Okay, I will be more precise then. If you look at function TAnalyzeThread::FindPrototypes, you will see the following piece of code

ARGINFO argInfo; p = pInfo->Args; int ss = 8;
for (k = 0; k < pInfo->ArgsNum; k++)
{
  FillArgInfo(k, callKind, &argInfo, &p, &ss);
  recN->procInfo->AddArg(&argInfo);
}

near the row 1750. If you look carefully - you will notice that FillArgInfo sets argInfo->Register properly, but then InfoProcInfo::AddArg(PARGINFO aInfo) does not care about aInfo->Register.

tmcdos avatar Jul 05 '16 08:07 tmcdos

By the way - just for your information, no offense please - writing You with capital letter is unusual and weird for native English speakers. For Russian and Bulgarian this is a polite form - but not for English people (see http://english.stackexchange.com/questions/30185/you-versus-you-as-polite-form-of-writing). This was out of the scope, so please forgive me :)

tmcdos avatar Jul 05 '16 08:07 tmcdos

I noticed something else. In function TFMain::StrapProc, when argInfo.Name is "MapToRunError" then variable locflags is 11 and argInfo.Register is True. But this can not be true, since MapToRunError is marked as using stdcall.

tmcdos avatar Jul 05 '16 11:07 tmcdos