Fix triggering of "buffer too small" error during some stack dumps.

Remove dlopen's debug_assert, for POSIX compatibility and because it
causes very ugly problems when dumping the stack if the Collada DLL is
missing.

This was SVN commit r7530.
This commit is contained in:
Ykkrosh 2010-05-09 19:52:13 +00:00
parent 549ff09c8b
commit ba7d237d9a
3 changed files with 5 additions and 2 deletions

View File

@ -95,6 +95,7 @@ class TestWdbgSym : public CxxTest::TestSuite
int ints[] = { 1,2,3,4,5 }; UNUSED2(ints);
wchar_t chars[] = { 'w','c','h','a','r','s',0 }; UNUSED2(chars);
wchar_t many_wchars[1024]; memset(many_wchars, 'a', sizeof(many_wchars));
debug_printf(L"\n(dumping stack frames may result in access violations..)\n");

View File

@ -695,7 +695,10 @@ static LibError dump_string(const u8* p, size_t el_size)
wchar_t buf[512];
if(el_size == sizeof(wchar_t))
wcscpy_s(buf, ARRAY_SIZE(buf), (const wchar_t*)p);
{
wcsncpy(buf, (const wchar_t*)p, ARRAY_SIZE(buf)); // can't use wcscpy_s because p might be too long
wcscpy_s(buf+ARRAY_SIZE(buf)-4, 4, L"..."); // ensure null-termination
}
// convert to wchar_t
else
{

View File

@ -57,7 +57,6 @@ void* dlopen(const char* so_name, int flags)
fs::path pathname = fs::change_extension(so_name, ".dll");
HMODULE hModule = LoadLibraryA(pathname.string().c_str());
debug_assert(hModule);
return void_from_HMODULE(hModule);
}