Re: FastCode MM B&V 0.55



Hi

Validate13 allocates 16 kB blocks until a out of memory exception is
received and then frees all blocks again. A MM must be robust towards this
kind of abuse with allocations of any block size. This function is modified
to use 160 kB blocks. Then we need 10 times fewer pointers. I recommend that
we add this function to make the validation even more thorough and the cost
of getting a longer running time for it.

function TMMValidation.Validate13x: Boolean;
var
Pointers : array[0..20000] of Pointer; // Modified
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
n : integer;

begin
n := 0;
try
repeat
//Allocate 160 kB pointer
GetMem(Pointers[n], 163840); //Modified
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PChar(Pointers[n])[4] := 'A';
Inc(n);
until n > High(Pointers);
Result := True; // no exception at all, and using more than 3
GB...interesting !
except
on E: EOutOfMemory do // that's the right exception...
Result := True
else // all other exceptions are wrong...
Result := False;
end;
//Release memory
while n > 0 do
begin
Dec(n);
FreeMem(Pointers[n]);
end;
end;

Best regards
Dennis Kjaer Christensen


.



Relevant Pages

  • Re: Differences in data description in programming languages
    ... That certainly is true of statics _and_ automatics. ... >>Those can happen in Cobol too, and have nothing to do with pointers. ... OO systems an exception will be passed up the process until it is ...
    (comp.lang.cobol)
  • Re: MiniDumpWriteDump
    ... I changed the structure to use pointers instead of using the types inline ... Now, when an exception occurs, and is caught my me (see sample code in same ... (Please forget my last posting's question about whether the API can access ... >>> End Sub ...
    (microsoft.public.vb.winapi)
  • Re: N1298 - try/finally for C
    ... Using a void*, or something containing a void*, gives ... Then we have a function that potentially throws an exception: ... If you mean some custom allocator, then we generally need to pass yet ... As for function pointers, and besides that throwing function pointers ...
    (comp.std.c)
  • RE: win32 heap overflow exploitation
    ... by another exception handler. ... As eEye often mentions it is possible to overwrite other locations, ... and PEB locking pointers. ... because ecx is unwritable address thus invokin exception handler. ...
    (Vuln-Dev)
  • Re: Try Catch Finally in MFC
    ... David / Joseph for you insight, ... Handle the exception. ... In the destructor of the C++ class deallocate pointers if they are ...
    (microsoft.public.vc.mfc)