RE: Helios:
Line 11 (bufffer.reads(name,size(long))); does this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
void MemBuffer::reads(char *dest, const size_t lensize)
{
size_t len = 0;
checkFits(lensize);
memcpy(&len, pos, lensize);
pos += lensize;
checkFits(len);
if (len)
memcpy(dest, pos, len);
else
*dest = '\0';
pos += len;
}
|
lensize is 0x00000004
checkFits passes fine
IMPORTANT:
after pos += lensize; pos is 0x001612a2 " dea BLACK{?}"
replace {?} for strange character, probably \r or \n . This is the old bug but I think this should not cause crash because in release configuration it works, just the strange character is pasted to the tree, so the item name in the view tree looks like " dea BLACK?" rectange instead "?"
before memcpy(&len, pos, lensize); is called, it contains these values:
len - 0x00000000
pos - 0x00161176 I can expand it and it shows: 0x0a (what's that?)
lensize - 0x00000004
as a result len is 0x0000000a (decimal 10), condition if (len) is true, memcpy(dest,pos,len) is performed. Then dest contains characters: " dea BLACKĚ....." Strange is that in the tree the items shows more characters after the item is copy/pasted. Looks like there should be incorrect len, but it is 10 and it is OK.
Finally pos+=len passes pos pointer to 0x00161184 and there is the strange char - it is the rectangle shape character. This is the only one character displayed by VS.
edit, now I got it. The strange character value is 0x03
CONCLUSION:
What reads did is: read 4 bytes of integer (size of the string name), shift pos += 4 bytes, checkFits, copy the string " dea BLACK" (10 characters total).
However why the dest contains more then 10 characters? There are Ě characters redundant showen in the string.
Maybe is there problem, that the author of the code forgot to paste null character on the end of name? This results that the name is not correct when the reads() returned. The len of the string is lost because its local variable of the reads(). Yet a note: name is private property of Trigger, limit to 128 chars.