Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid heap argument reports in basic_streambuf #373

Open
derekbruening opened this issue Nov 28, 2014 · 6 comments
Open

Invalid heap argument reports in basic_streambuf #373

derekbruening opened this issue Nov 28, 2014 · 6 comments

Comments

@derekbruening
Copy link
Contributor

From timurrrr@google.com on May 03, 2011 08:41:12

As of r273 on XP 32-bit

===font_metrics.cpp===
#define NOMINMAX
#include <windows.h>

#include <stdio.h>
#include <math.h>

#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+0x1bb29> MSVCP90D.dll!std::basic_streambuf<char,std::char_traits >::setp
0x104ef453 <MSVCP90D.dll+0x6f453> MSVCP90D.dll!std::ios_base::_Ios_base_dtor
0x1048d95b <MSVCP90D.dll+0xd95b> MSVCP90D.dll!std::ios_base::~ios_base
0x104b848a <MSVCP90D.dll+0x3848a> MSVCP90D.dll!std::basic_ios<wchar_t,std::char_traits<wchar_t> >::~basic_ios<wchar_t,std::char_traits<wchar_t> >
0x1049d1ff <MSVCP90D.dll+0x1d1ff> MSVCP90D.dll!std::basic_ostream<wchar_t,std::char_traits<wchar_t> >::`vbase destructor'
0x104fd32f <MSVCP90D.dll+0x7d32f> MSVCP90D.dll!LPoly
0x104f50dc <MSVCP90D.dll+0x750dc> MSVCP90D.dll!LPoly
0x104f5310 <MSVCP90D.dll+0x75310> MSVCP90D.dll!LPoly
0x104f51d1 <MSVCP90D.dll+0x751d1> MSVCP90D.dll!LPoly
0x7c90118a <ntdll.dll+0x118a> ntdll.dll!LdrInitializeThunk
0x7c9224ca <ntdll.dll+0x224ca> ntdll.dll!RtlDestroyEnvironment
0x7c81caae <KERNEL32.dll+0x1caae> KERNEL32.dll!IsValidLocale

Error #13: INVALID HEAP ARGUMENT: free 0x003535d8
@0:00:01.125 in thread 2552
0x1048bed2 <MSVCP90D.dll+0xbed2> MSVCP90D.dll!std::ctype<wchar_t>::~ctype<wchar_t>
0x1048c51f <MSVCP90D.dll+0xc51f> MSVCP90D.dll!std::ctype<wchar_t>::`default constructor closure'
0x10498aa9 <MSVCP90D.dll+0x18aa9> MSVCP90D.dll!std::basic_streambuf<unsigned short,std::char_traits >::_Pninc
0x104eec6a <MSVCP90D.dll+0x6ec6a> MSVCP90D.dll!std::_Locinfo::_Locinfo_dtor
0x104eec21 <MSVCP90D.dll+0x6ec21> MSVCP90D.dll!std::_Locinfo::_Locinfo_dtor
0x104eebf5 <MSVCP90D.dll+0x6ebf5> MSVCP90D.dll!std::_Locinfo::_Locinfo_dtor
0x104ee4c7 <MSVCP90D.dll+0x6e4c7> MSVCP90D.dll!std::_Lockit::_Lockit_dtor
0x104f50dc <MSVCP90D.dll+0x750dc> MSVCP90D.dll!LPoly
0x104f5310 <MSVCP90D.dll+0x75310> MSVCP90D.dll!LPoly
0x104f51d1 <MSVCP90D.dll+0x751d1> MSVCP90D.dll!LPoly
0x7c90118a <ntdll.dll+0x118a> ntdll.dll!LdrInitializeThunk
0x7c9224ca <ntdll.dll+0x224ca> ntdll.dll!RtlDestroyEnvironment

Error #15: INVALID HEAP ARGUMENT: free 0x00352be0
@0:00:01.140 in thread 2552
0x1048b5fb <MSVCP90D.dll+0xb5fb> MSVCP90D.dll!std::ctype::_Tidy
0x1048b570 <MSVCP90D.dll+0xb570> MSVCP90D.dll!std::ctype::~ctype
0x1048ba4f <MSVCP90D.dll+0xba4f> MSVCP90D.dll!std::ctype::`default constructor closure'
0x10498aa9 <MSVCP90D.dll+0x18aa9> MSVCP90D.dll!std::basic_streambuf<unsigned short,std::char_traits >::_Pninc
0x104eec6a <MSVCP90D.dll+0x6ec6a> MSVCP90D.dll!std::_Locinfo::_Locinfo_dtor
0x104eec21 <MSVCP90D.dll+0x6ec21> MSVCP90D.dll!std::_Locinfo::_Locinfo_dtor
0x104eebf5 <MSVCP90D.dll+0x6ebf5> MSVCP90D.dll!std::_Locinfo::_Locinfo_dtor
0x104ee4c7 <MSVCP90D.dll+0x6e4c7> MSVCP90D.dll!std::_Lockit::_Lockit_dtor
0x104f50dc <MSVCP90D.dll+0x750dc> MSVCP90D.dll!LPoly
0x104f5310 <MSVCP90D.dll+0x75310> MSVCP90D.dll!LPoly
0x104f51d1 <MSVCP90D.dll+0x751d1> MSVCP90D.dll!LPoly
0x7c90118a <ntdll.dll+0x118a> ntdll.dll!LdrInitializeThunk

Error #16: INVALID HEAP ARGUMENT: free 0x00352920
@0:00:01.156 in thread 2552
0x10498aad <MSVCP90D.dll+0x18aad> MSVCP90D.dll!std::basic_streambuf<unsigned short,std::char_traits >::_Pninc
0x104892c1 <MSVCP90D.dll+0x92c1> MSVCP90D.dll!std::locale::~locale
0x1049bc51 <MSVCP90D.dll+0x1bc51> MSVCP90D.dll!std::basic_streambuf<char,std::char_traits >::setp
0x1049bb25 <MSVCP90D.dll+0x1bb25> MSVCP90D.dll!std::basic_streambuf<char,std::char_traits >::setp
0x1049a064 <MSVCP90D.dll+0x1a064> MSVCP90D.dll!std::basic_streambuf<char,std::char_traits >::~basic_streambuf<char,std::char_traits >
0x1049b2aa <MSVCP90D.dll+0x1b2aa> MSVCP90D.dll!std::basic_filebuf<char,std::char_traits >::~basic_filebuf<char,std::char_traits >
0x104fce4f <MSVCP90D.dll+0x7ce4f> MSVCP90D.dll!LPoly
0x104f50dc <MSVCP90D.dll+0x750dc> MSVCP90D.dll!LPoly
0x104f5310 <MSVCP90D.dll+0x75310> MSVCP90D.dll!LPoly
0x104f51d1 <MSVCP90D.dll+0x751d1> MSVCP90D.dll!LPoly
0x7c90118a <ntdll.dll+0x118a> ntdll.dll!LdrInitializeThunk
0x7c9224ca <ntdll.dll+0x224ca> ntdll.dll!RtlDestroyEnvironment

Could be related to issue #55 .

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

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on December 19, 2011 09:28:22

note that /MD with /D_DEBUG is not supported today ( issue #606 )

without /D_DEBUG I can't repro this on win7 or xp64. about to try xp32.

Owner: bruen...@google.com

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on December 19, 2011 10:36:27

well I don't have a compiler on my xp32 machine, and my build from another machine depends on a different version of msvcr*.dll. but with /MTd on xp32 I can't repro any problem.

Owner: ---

@derekbruening
Copy link
Contributor Author

From timurrrr@google.com on December 19, 2011 12:30:13

Can you try to repro that on our DrM bot?

Similar reports happen on our Chromium DrM bot http://build.chromium.org/p/chromium.fyi/builders/Windows%20Tests%20%28DrMemory%29/builds/1118/steps/memory%20test%3A%20base/logs/stdio

Cc: rnk@google.com

@derekbruening
Copy link
Contributor Author

From rnk@google.com on December 19, 2011 12:37:09

Derek is investigating the stuff we're seeing on the Chromium DrM bots right now, which I think is different from this report because it's all new/free mismatches. We can both reproduce easily in googleurl_unittests.exe on Win7 by setting MEMORY_TOOLS_GYP_DEFINES. Something with /O1 is tickling the way we do mismatch checking.

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on December 19, 2011 12:41:08

timur, I was looking at this earlier b/c of the chrome bot reports (hence the updates earlier today), and concluded there's no relation. chrome bots are issue #722 .

@derekbruening
Copy link
Contributor Author

From timurrrr@google.com on December 19, 2011 12:43:25

OK, got it.
Sorry for the noise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant