Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

C::B crash svn9134 wx2.8.12 with IO.ExecuteAndGetOutputAndError in srcipt

<< < (2/3) > >>

LETARTARE:
@BlueHazzard
1-
--- Quote ---the problem is the length of the string to print.
--- End quote ---
Yes I confirm depending on the version of Code::Blocks,  it is the length of the string is limited before a crash.
Here are some tests I had done:
http://forums.codeblocks.org/index.php/topic,15853.0.html
I just update the test with "Code::Blocks 12.11"  and r9143 , (see attached file)
The maximum length before crash seems to be around 3000 bytes !!

2-
--- Quote ---ExecuteAndGetOutputAndError
--- End quote ---
see discussion for his appearance with r8059 :
http://forums.codeblocks.org/index.php/topic,15993.0.html

3-
I can not reproduce your last debug list, could you explain in detail how you get it ?

[attachment deleted by admin]

BlueHazzard:

--- Quote from: LETARTARE on June 14, 2013, 09:38:26 am ---@BlueHazzard
1-
--- Quote ---the problem is the length of the string to print.
--- End quote ---
Yes I confirm depending on the version of Code::Blocks,  it is the length of the string is limited before a crash.
Here are some tests I had done:
http://forums.codeblocks.org/index.php/topic,15853.0.html
I just update the test with "Code::Blocks 12.11"  and r9143 , (see attached file)
The maximum length before crash seems to be around 3000 bytes !!

--- End quote ---

So we can confim, that the bug is somewhere in printing large strings. I'm not on my home pc so i can't search right now, but as soon i will get home i will debug in the print function.
We have to confirm if the bug is only in printing or the problem exists with large strings. If it is only in printing, i think a fix shouldn't be to difficult. It seems to be something like writing in an out of range pointer....


--- Quote from: LETARTARE on June 14, 2013, 09:38:26 am ---3-
I can not reproduce your last debug list, could you explain in detail how you get it ?

--- End quote ---
did you mean the backtrace? this backtrace occoured if i printed (or created, i can't specify right no) a too long string. The backtrace is different from run to run, so even i can't reproduce it... This looks like the print (or the creation) of the string overwrites something somewhere in the memory...

i will try to debug an report...

my main focus for now are the print function and the wxString.tostring() function. I think the bug is somewhere located there.


--- Quote from: BlueHazzard on June 13, 2013, 08:28:02 pm ---a second problem i have, is a error Message i get at the end of the script if i use the line ExecuteAndGetOutputAndError:

--- Code: ---can't open file '' (error 3 the system can't find the file)
--- End code ---
i have no plan when or from where this msg get fired.... if i debug the code the ExecuteAndGetOutputAndError gets executed fine with no error, also the script terminates with no error, but after a few seconds the message box pops up... It seems this comes from the deep in wxWidgets?

--- End quote ---
here i have no clue where i can look into.... i'm even not sure if the error is somewhere in ExecuteAndGetOutputAndError or somewhere else... I have also no idea how to debug.... the problem is i can't find the place where this error gets fired... i fa i make a search in files in the c::b workspace  for "can't open file" there are no results. So i think this comes from the deeps of wxWidgets (or even the os) but this is only a assumption.

greetings

BlueHazzard:
Hello
i found the code where the c::b crash:


--- Code: ---static void ScriptsPrintFunc(HSQUIRRELVM /*v*/, const SQChar * s, ...)
{
    static SQChar temp[2048];
    va_list vl;
    va_start(vl,s);
    scvsprintf( temp,s,vl);
    wxString msg = cbC2U(temp);
    Manager::Get()->GetLogManager()->DebugLog(msg);
    va_end(vl);

    s_ScriptErrors << msg;
}

--- End code ---
and

--- Code: ---static void ScriptConsolePrintFunc(HSQUIRRELVM /*v*/, const SQChar * s, ...)
{
    static SQChar temp[2048];
    va_list vl;
    va_start(vl,s);
    scvsprintf( temp,s,vl);
    wxString msg = cbC2U(temp);
    va_end(vl);

    if (s_Console)
        s_Console->Log(msg);
    Manager::Get()->GetScriptingManager()->InjectScriptOutput(msg);
}

--- End code ---

we have only a buffer for 2048 Byte....

so the question is, how we fix this?

a quick and dirty solution is to use snprintf a other solution would be to use wxString.PrintfV().
im currently trying to implement a PrintfV version, but i is very slow and i have problems with the %s is interpreted as unicode, but i'm working on this....

greetings

BlueHazzard:
Hello,
i think i have fixed the bug.
It is a fast but a bit memory extensive way. I have no idea if it is working with unicode, but if the old code was unicode capable this should also be...

patch is in the batch tracker ID:003479

oBFusCATed:
Quick comment:
You have lots of code duplication.
Can you make a function for the allocation?

Also do you have an explanation why it crashes? As far as I know scvsprintf could not overflow the buffer...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version