Hi, i'm building a application and at a certain point, i get the weirdest runtime errors:
for example:
for some or other reason, the app jumps to the first catch block while executing this line:Code:try{ bufptr += my_strcpy(target->ServerName, bufptr); bufptr += my_strcpy(target->MapName, bufptr); bufptr += my_strcpy(target->Game, bufptr); bufptr += my_strcpy(target->GameType, bufptr); bufptr += 2; //Skip appid because it is no use to us target->PlayerCount = static_cast<unsigned short>(*bufptr++); target->MaxPlayers = static_cast<unsigned short>(*bufptr++); bufptr+=3; } catch (std::bad_alloc&){ return -1; } catch(void *){ return -1; }
Code:bufptr+=3;the jump leads straight to the catch block so why is it there :SCode:009936F5 mov eax,dword ptr [ebp-48h] 009936F8 add eax,3 009936FB mov dword ptr [ebp-48h],eax 009936FE jmp $LN19 (99372Ch)
Some other strange things are that whether i place some other code at that location. the catch block kicks in at that code.
you might think that with buffer+=3, i have a overflow but thats not. bufptr points to the very beginning of a large large array of chars named buffer.
my_strcpy definition:
editCode:inline int my_strcpy(char* source, char* target){ int counter(0); while (*target!=0){ *source++=*target++; ++counter; } *source = 0; return counter+1; }
yet another weird thing. the function wont return with the return -1 cmd in the catch block. it just continues :S



LinkBack URL
About LinkBacks


