bug in hashtable test
- From: Miroslaw Dobrzanski-Neumann <mne mosaic-ag com>
- To: GTKDEV <gtk-devel-list gnome org>
- Subject: bug in hashtable test
- Date: Fri, 8 Feb 2002 18:17:06 +0100
glib-1.3.13/tests/hash-test.c
276 for (i=0; i<20; i++)
277 {
278 if (((i % 2) == 0) || (i == 3))
279 i++;
280
281 sprintf (key, "%d", i);
282 g_assert (atoi(key) == i);
283
284 sprintf (val, "%d value", i);
285 g_assert (atoi (val) == i);
286
287 orig_key = orig_val = NULL;
288 found = g_hash_table_lookup_extended (h, key,
289 (gpointer)&orig_key,
290 (gpointer)&orig_val);
291 g_assert (found);
292
293 g_assert (orig_key != NULL);
294 g_assert (strcmp (key, orig_key) == 0);
295 g_free (orig_key);
296
297 g_assert (orig_val != NULL);
298 g_assert (strcmp (val, orig_val) == 0);
299 g_free (orig_val);
300 }
in lines 295, 299 is key and value memory freed end possibly reused by the
libc. the call to g_hash_table_lookup_extended() in line 288 afterwards uses
the invalidated key value intenally.
simple check using a free malloc debugger under linux i.e. efence veryfies this
$ env LD_PRELOAD=/usr/lib/libefence.so EF_PROTECT_FREE=1 EF_FILL=85 tests/hash-test
libefence makes all freed memory inacessible -> SEGV
could you correct this test?
regards
--
Miroslaw Dobrzanski-Neumann
MOSAIC SOFTWARE AG
Base Development and Research
Tel +49-2225-882-291
Fax +49-2225-882-201
E-mail: mne mosaic-ag com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]