A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-May/024361.html below:

[Python-Dev] Overwriting objects before deallocating them

[Python-Dev] Overwriting objects before deallocating them [Python-Dev] Overwriting objects before deallocating themAndrew Kuchling akuchlin@mems-exchange.org
Fri, 24 May 2002 10:57:53 -0400
In the cryptography toolkit, the deallocators in the C extensions all
overwrite the object's contents before deallocating it.  Is this dodgy
practice?  Is it likely or possible that some day PyObject_Del will
need to look at the contents of a non-GC-supporting object before
freeing it?  (Encryption or hashing objects are not containers, and
it's highly unlikely they ever will be, so they'll never need to
support GC traversal.)

--amk

Example code:  

static void
ALGdealloc(PyObject *ptr)
{
	int i;
	char *obj=(char *)ptr;
	
	/* Overwrite the contents of the object, just in case... */
	for (i = 0; i < sizeof(ALGobject); i++)
		*(obj + i) = '\0';
	PyObject_DEL(ptr);
}

(Note to self: use memset().)




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4