|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
[PATCH] Prevents crash in gvrastercache.cWhen getting a (hostile) dataset with huge block dimensions, a crash can occur
in gvrastercache.c if memory cannot be allocated This patch replaces the g_new0 call that crashes with GLIB 1.2 by the standard malloc. Index: gvrastercache.c =================================================================== RCS file: /cvsroot/openev/openev/gvrastercache.c,v retrieving revision 1.12 diff -u -r1.12 gvrastercache.c --- gvrastercache.c 20 Jun 2000 13:26:55 -0000 1.12 +++ gvrastercache.c 16 Nov 2007 19:58:12 -0000 @@ -32,6 +32,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "gvrastercache.h" static gint gv_cache_max = 20 * 1024 * 1024; @@ -67,9 +68,10 @@ for( i = 0; i < cache->max_lod; i++ ) { - cache->tiles[i] = g_new0(gv_raster_cache_tile*,cache->max_tiles); + cache->tiles[i] = malloc(sizeof(gv_raster_cache_tile*) * cache->max_tiles); if( cache->tiles[i] == NULL ) return NULL; + memset(cache->tiles[i], 0, sizeof(gv_raster_cache_tile*) * cache->max_tiles); } return cache; @@ -296,7 +298,7 @@ gv_raster_cache_flush_all( cache ); for( lod = 0; lod < cache->max_lod; lod++ ) - g_free( cache->tiles[lod] ); + if (cache->tiles[lod]) free( cache->tiles[lod] ); g_free( cache->tiles ); ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Openev-discuss mailing list Openev-discuss@... https://lists.sourceforge.net/lists/listinfo/openev-discuss |
|
|
Re: [PATCH] Prevents crash in gvrastercache.cEven Rouault wrote:
> When getting a (hostile) dataset with huge block dimensions, a crash can occur > in gvrastercache.c if memory cannot be allocated > This patch replaces the g_new0 call that crashes with GLIB 1.2 by the standard > malloc. Even, Patch applied. Best regards, -- ---------------------------------------+-------------------------------------- I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@... light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush | President OSGeo, http://osgeo.org ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Openev-discuss mailing list Openev-discuss@... https://lists.sourceforge.net/lists/listinfo/openev-discuss |
| Free embeddable forum powered by Nabble | Forum Help |