ntdll: implement FLG_HEAP_ENABLE_TAIL_CHECK

Eric Pouech eric.pouech at orange.fr
Wed Nov 18 14:47:43 CST 2009


Dan Kegel a écrit :
> (Without a change like this, Valgrind can't properly
> detect buffer overruns, but even without Valgrind,
> this change will improve Wine's ability to detect
> buffer overruns.)
>
> With this change, users can enable buffer overrun
> detection in Wine by setting WINE_GLOBAL_FLAGS=0x10.
> This is like the overrun detection in Windows enabled by
> setting NtGlobalFlags to 0x10, but checks 16 bytes
> rather than 8, and works for large allocations,
> not just small ones.
>
> With this enabled, a remarkable number of tests break.
>
> I'm posting this to wine-devel for review while I
> add valgrind annotations (which should make
> it easier to tell whether the errors it detects are real or spurious)
> and fix the spurious breakages.
>
> Note that this change is a no-op under normal circumstances;
> without setting WINE_GLOBAL_FLAGS, you shouldn't
> see any breakage.
>   
> ------------------------------------------------------------------------
>
>
Hi Dan

interesting stuff
however, you don't handle correctly HeapReAlloc(..., ZERO_MEMORY,...) 
calls when the already allocated block grows in place

=> you get a block like OGN (O = old block, G=guard for old block, N=new 
block extension)
what's zeroed out is N, whereas you should "repaint" GN into ZG (zero of 
size(N), Guard)
which may also explain lots of errors when running the tool

A+

-- 
Eric Pouech
"The problem with designing something completely foolproof is to underestimate the ingenuity of a complete idiot." (Douglas Adams)






More information about the wine-devel mailing list