DynamoRIO / DynamoRIO/drmemory

Invalid heap argument reports in basic_streambuf

Open
#373 6 comments 0 reactions 0 assignees View on GitHub
Bug-FalsePositive Migrated OpSys-Windows Priority-Medium
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

_From [timurrrr@google.com](https://code.google.com/u/timurrrr@google.com/) on May 03, 2011 08:41:12_

As of r273 on XP 32-bit

===font_metrics.cpp===
#define NOMINMAX
#include

#include
#include

#include

#pragma comment(lib, "gdi32.lib")
#pragma comment(lib, "user32.lib")

int main() {
HDC screen_dc = GetDC(NULL);
TEXTMETRICW font_metrics;
SetMapMode(screen_dc, MM_TEXT);
GetTextMetricsW(screen_dc, &font_metrics);
const int a = std::max(1, static_cast(font_metrics.tmHeight)),
b = std::max(1, static_cast(font_metrics.tmAscent));
printf("%d %d\n", a, b);
printf("Hello, world!\n");
return 0;
}
#

cl /Zi /D_DEBUG /MD font_metrics.cpp
...
Error `#1`: INVALID HEAP ARGUMENT: free 0x003562c0
@0:00:00.984 in thread 2552
0x1049bb29 MSVCP90D.dll!std::basic_streambuf >::setp
0x104ef453 MSVCP90D.dll!std::ios_base::_Ios_base_dtor
0x1048d95b MSVCP90D.dll!std::ios_base::~ios_base
0x104b848a MSVCP90D.dll!std::basic_ios >::~basic_ios >
0x1049d1ff MSVCP90D.dll!std::basic_ostream >::`vbase destructor'
0x104fd32f MSVCP90D.dll!LPoly
0x104f50dc MSVCP90D.dll!LPoly
0x104f5310 MSVCP90D.dll!LPoly
0x104f51d1 MSVCP90D.dll!LPoly
0x7c90118a ntdll.dll!LdrInitializeThunk
0x7c9224ca ntdll.dll!RtlDestroyEnvironment
0x7c81caae KERNEL32.dll!IsValidLocale

Error `#13`: INVALID HEAP ARGUMENT: free 0x003535d8
@0:00:01.125 in thread 2552
0x1048bed2 MSVCP90D.dll!std::ctype::~ctype
0x1048c51f MSVCP90D.dll!std::ctype::`default constructor closure'
0x10498aa9 MSVCP90D.dll!std::basic_streambuf >::_Pninc
0x104eec6a MSVCP90D.dll!std::_Locinfo::_Locinfo_dtor
0x104eec21 MSVCP90D.dll!std::_Locinfo::_Locinfo_dtor
0x104eebf5 MSVCP90D.dll!std::_Locinfo::_Locinfo_dtor
0x104ee4c7 MSVCP90D.dll!std::_Lockit::_Lockit_dtor
0x104f50dc MSVCP90D.dll!LPoly
0x104f5310 MSVCP90D.dll!LPoly
0x104f51d1 MSVCP90D.dll!LPoly
0x7c90118a ntdll.dll!LdrInitializeThunk
0x7c9224ca ntdll.dll!RtlDestroyEnvironment

Error `#15`: INVALID HEAP ARGUMENT: free 0x00352be0
@0:00:01.140 in thread 2552
0x1048b5fb MSVCP90D.dll!std::ctype::_Tidy
0x1048b570 MSVCP90D.dll!std::ctype::~ctype
0x1048ba4f MSVCP90D.dll!std::ctype::`default constructor closure'
0x10498aa9 MSVCP90D.dll!std::basic_streambuf >::_Pninc
0x104eec6a MSVCP90D.dll!std::_Locinfo::_Locinfo_dtor
0x104eec21 MSVCP90D.dll!std::_Locinfo::_Locinfo_dtor
0x104eebf5 MSVCP90D.dll!std::_Locinfo::_Locinfo_dtor
0x104ee4c7 MSVCP90D.dll!std::_Lockit::_Lockit_dtor
0x104f50dc MSVCP90D.dll!LPoly
0x104f5310 MSVCP90D.dll!LPoly
0x104f51d1 MSVCP90D.dll!LPoly
0x7c90118a ntdll.dll!LdrInitializeThunk

Error `#16`: INVALID HEAP ARGUMENT: free 0x00352920
@0:00:01.156 in thread 2552
0x10498aad MSVCP90D.dll!std::basic_streambuf >::_Pninc
0x104892c1 MSVCP90D.dll!std::locale::~locale
0x1049bc51 MSVCP90D.dll!std::basic_streambuf >::setp
0x1049bb25 MSVCP90D.dll!std::basic_streambuf >::setp
0x1049a064 MSVCP90D.dll!std::basic_streambuf >::~basic_streambuf >
0x1049b2aa MSVCP90D.dll!std::basic_filebuf >::~basic_filebuf >
0x104fce4f MSVCP90D.dll!LPoly
0x104f50dc MSVCP90D.dll!LPoly
0x104f5310 MSVCP90D.dll!LPoly
0x104f51d1 MSVCP90D.dll!LPoly
0x7c90118a ntdll.dll!LdrInitializeThunk
0x7c9224ca ntdll.dll!RtlDestroyEnvironment

Could be related to issue #55 .

_Original issue: http://code.google.com/p/drmemory/issues/detail?id=373_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.