stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov" <Far...@kyiv.vdiweb.com>
Subject RE: Environment for the test of the string functions memory overrun with example
Date Mon, 10 Jul 2006 15:11:42 GMT
  It looks like it is needed to maintain the list of the information
records about allocated blocks for rw_alloc() / rw_free() functions
because munmap() function requires specification of the size of the
freeing block, but rw_free doesn't contains that argument. Another thing
is the requirement "(e.g., rw_free() shouldn't crash even when passed an
invalid pointer or a valid pointer to a corrupt chunk of memory)" but
http://www.opengroup.org/pubs/online/7908799/xsh/munmap.html page says
"the behavior of munmap() function is unspecified if the mapping was not
established by a call to mmap()".

  If the list of blocks is really needed then is may be useful to add
the checks for memory-leaks and other like checks performed by
operator_new() from new.cpp. But as i understand operator_new() may in
some cases (i.e. some environment variable is set) call rw_alloc()
instead of malloc() and such checks will be performed twice.

  Maybe maintaining of the list of blocks is unnecessary complication
and it will be enough to add an additional argument size_t nbytes to
rw_free?

  What do you think about this?

Farid.

Mime
View raw message