[GRASS-dev] Mem bug in G_squeeze ()

benjamin.ducke at ufg.uni-kiel.de benjamin.ducke at ufg.uni-kiel.de
Tue Apr 15 07:36:37 EDT 2008


I recently valgrind'd some of my code and there were always
small problems involving G_squeeze.

The problem seems to be with parsing strings that contain
nothing but whitespace, such as "\n".

For such strings, valgrind complains:

==15705== Invalid read of size 1
==15705==    at 0x411EEAE: G_squeeze (squeeze.c:62)
==15705==    by 0x804BF8C: run_list (run.c:611)
==15705==    by 0x8049E19: main (main.c:457)
==15705==  Address 0x6584E2F is 1 bytes before a block of size 2 alloc'd
==15705==    at 0x4022765: malloc (vg_replace_malloc.c:149)
==15705==    by 0x40EEA12: G_malloc (alloc.c:39)
==15705==    by 0x411EF4F: G_store (store.c:36)
==15705==    by 0x804BF82: run_list (run.c:610)
==15705==    by 0x8049E19: main (main.c:457)

It seems to me that line 62 of squeeze.c needs to be conditionalized in
some way.

Cheers,

Ben


-- 
Benjamin Ducke
Senior Applications Support and Development Officer

Oxford Archaeological Unit Limited
Janus House
Osney Mead
OX2 0ES
Oxford, U.K.

Tel.: ++44 (0)1865 263 800
benjamin.ducke at oxfordarch.co.uk






More information about the grass-dev mailing list