http://bugs.winehq.org/show_bug.cgi?id=10179
Summary: Heap corruption in tiny example program Product: Wine Version: CVS/GIT Platform: Other OS/Version: other Status: NEW Severity: enhancement Priority: P2 Component: wine-kernel AssignedTo: wine-bugs@winehq.org ReportedBy: dank@kegel.com
The call to GlobalHandle in the following program causes the warning
warn:heap:HEAP_ValidateInUseArena Heap 0x110000: invalid in-use arena magic for 0x110810
To reproduce, copy the following program to dlls/kernel32/tests/bug.c and compile with
../../../tools/winegcc/winegcc -B../../../tools/winebuild -mconsole -I../../../include bug.c ../../../libs/port/libwine_port.a -ladvapi32 -lkernel32
then run with
WINEDEBUG=warn+heap ./a.out
#include <stdarg.h> #include <windef.h> #include <winbase.h> #include <winerror.h> #include <assert.h>
int main(int argc, char **argv) { HGLOBAL hmem,hmem2; UCHAR *pmem;
SetLastError(NO_ERROR); hmem=GlobalAlloc(0, 1); assert(hmem != NULL); hmem=GlobalReAlloc(hmem,0,GMEM_MODIFY | GMEM_MOVEABLE); pmem=GlobalLock(hmem); hmem2=GlobalHandle(pmem); // Here's the line that causes the warning assert(hmem2==hmem); assert(pmem!=NULL && !GlobalUnlock(hmem) && GetLastError()==NO_ERROR); assert(!GlobalFree(hmem)); assert(HeapValidate(GetProcessHeap(), 0, 0)); return 0; }
This was boiled down from alloc.c (which has a similar warning).
http://bugs.winehq.org/show_bug.cgi?id=10179
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Heap corruption in tiny |Spurious heap warning in |example program |tiny example program
--- Comment #1 from Dan Kegel dank@kegel.com 2007-10-26 13:43:13 --- Alexandre wrote: "That's not heap corruption, it's the expected behavior of GlobalHandle when called with a pointer to a moveable block."
Then the warning is spurious, and should be suppressed.
http://bugs.winehq.org/show_bug.cgi?id=10179
--- Comment #2 from Dan Kegel dank@kegel.com 2007-10-28 14:54:50 --- Alexandre replies: "Well, that's why it's a WARN, it indicates that something may be wrong, but may also be a normal failure. If it were only displayed in cases where there's a real error it would be an ERR (and it actually is an ERR when called for internal pointers that we know should be valid)."
Grumble. Guess I'll submit a patch that makes the error message less scary.
http://bugs.winehq.org/show_bug.cgi?id=10179
scguy318 nodisgod@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nodisgod@yahoo.com
--- Comment #3 from scguy318 nodisgod@yahoo.com 2008-07-17 13:55:51 --- Should this bug remain open? I'm not aware of any change to dlls/ntdll/heap.c with regards to the warning message.
http://bugs.winehq.org/show_bug.cgi?id=10179
--- Comment #4 from Dan Kegel dank@kegel.com 2008-07-17 14:55:17 --- I think it should remain open... somebody should still make that message less scary.
http://bugs.winehq.org/show_bug.cgi?id=10179
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|CVS/GIT |unspecified
--- Comment #5 from Austin English austinenglish@gmail.com 2009-01-18 03:46:38 --- Removing deprecated CVS/GIT version tag. Please retest in current git. If the bug is still present in today's wine, but was not present in some earlier version of wine, please update version field to earliest known version of wine that had the bug. Thanks!
http://bugs.winehq.org/show_bug.cgi?id=10179
--- Comment #6 from Luca Bennati lucak3@gmail.com 2009-08-12 14:07:48 --- Still valid in wine-1.1.27-126-gc92bb27
The message is almost the same: warn:heap:HEAP_ValidateInUseArena Heap 0x110000: invalid in-use arena magic 00555555 for 0x110948
http://bugs.winehq.org/show_bug.cgi?id=10179
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX
--- Comment #7 from Alexandre Julliard julliard@winehq.org 2009-08-12 16:08:24 --- There's nothing to fix here.
http://bugs.winehq.org/show_bug.cgi?id=10179
--- Comment #8 from Dan Kegel dank@kegel.com 2009-08-12 16:09:57 --- I guess heap warnings are useless then.
http://bugs.winehq.org/show_bug.cgi?id=10179
--- Comment #9 from Alexandre Julliard julliard@winehq.org 2009-08-12 16:29:42 --- They are warnings; they point to areas where they may (or may not) be a problem. It's up to you to figure out if it's a real problem. That doesn't make them useless.
http://bugs.winehq.org/show_bug.cgi?id=10179
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED Component|kernel32 |-unknown
--- Comment #10 from Dmitry Timoshkov dmitry@codeweavers.com 2009-08-13 02:36:26 --- Closing wontfix.