Saturday, February 11, 2012

StingrayStudio 10.4 has a 64bit bug

When upgrading our product to 64bit in the end of last year, I found a bug of StingrayStudio 10.4, which causes a 64bit pointer truncated when converting it to DWORD.

refer to “Toolkit/trcore.inl”, search _WIN64, and you can find below codes:

   1: #ifdef _WIN64 //RW64
   2:                 // Possible pointer truncation.
   3:                 VERIFY(((SEC_TREEBASE*)this)->SetItemData(nIndex++, reinterpret_cast<DWORD>(pNodeLoop)));
   4: #else
   5:                 VERIFY(((SEC_TREEBASE*)this)->SetItemData(nIndex++, (DWORD)pNodeLoop));
   6: #endif //_WIN64



It seems that the bug has been mentioned in the comments, while no fix applied. Changing the _WIN64 case to reinterpret_cast<DWORD_PTR> can solve the problem. Then the StingrayStudio needs to be rebuilt.


The bug may not happen if the memory address is below 4g, so, either make sure the memory address is higher enough or enable 64bit application’s TOP_DOWN memory allocation strategy by updating the registry and restarting the machine.

No comments:

Post a Comment