DynamoRIO / DynamoRIO/drmemory
VS2008 CRT bug lead to app_suite_tests crash
- Dominant language
- C
- Stars
- 2.7k
- Forks
- 290
- PR merge metrics
- No merged PRs in 30d
Description
_From [Godspeed...@gmail.com](https://code.google.com/u/106728427585974403280/) on March 07, 2014 03:05:10_
I build Dr.M using VS2008 Express in Win7 64bit.
The target is win32 platform release.
When i run app_suite_tests.exe it crashed at test MallocTests.CallocOverflow.
This test case at tests/app_suite/malloc_tests.cpp:
TEST(MallocTests, CallocOverflow) {
/\* Ensure our calloc replacement or wrapping handles overflow */
#ifdef X64
ASSERT_EQ(NULL, calloc(0x100000LLU, 0x100000000001LLU));
#else
ASSERT_EQ(NULL, calloc(0x00067000U, 0x00002800U));
#endif
}
I write a simple program to check calloc function:
#include
#include
int main()
{
void \* p = NULL;
p = calloc(0x00067000U, 0x00002800U);
printf("%x\n", p);
return 0;
}
It also crashed for Assertion Failed:
Expression: (_HEAP_MAXREQ/nNum) >= nSize
This's a bug in VS2008 library and has been fix in VS2010. https://connect.microsoft.com/VisualStudio/feedback/details/356599/calloc-crashes-if-total-size-heap-maxreq I compile it again using VS2010, calloc safety return NULL.
I think wiki's HowToBuild should be updated about this app_suite_tests crash.
**Attachment:** [calloc.jpg calloc.bmp](http://code.google.com/p/drmemory/issues/detail?id=1471)
_Original issue: http://code.google.com/p/drmemory/issues/detail?id=1471_
Contributor guide
Assessment
This issue has not been assessed yet.