[GRASS-SVN] r53137 - grass/trunk/lib/gpde
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Sep 9 03:43:39 PDT 2012
Author: mmetz
Date: 2012-09-09 03:43:39 -0700 (Sun, 09 Sep 2012)
New Revision: 53137
Modified:
grass/trunk/lib/gpde/N_arrays.c
Log:
gpde lib: fix integer overflow
Modified: grass/trunk/lib/gpde/N_arrays.c
===================================================================
--- grass/trunk/lib/gpde/N_arrays.c 2012-09-09 09:42:10 UTC (rev 53136)
+++ grass/trunk/lib/gpde/N_arrays.c 2012-09-09 10:43:39 UTC (rev 53137)
@@ -94,7 +94,7 @@
if (data->type == CELL_TYPE) {
data->cell_array =
- (CELL *) G_calloc(data->rows_intern * data->cols_intern,
+ (CELL *) G_calloc((size_t) data->rows_intern * data->cols_intern,
sizeof(CELL));
G_debug(3,
"N_alloc_array_2d: CELL array allocated rows_intern %i cols_intern %i offset %i",
@@ -102,7 +102,7 @@
}
else if (data->type == FCELL_TYPE) {
data->fcell_array =
- (FCELL *) G_calloc(data->rows_intern * data->cols_intern,
+ (FCELL *) G_calloc((size_t) data->rows_intern * data->cols_intern,
sizeof(FCELL));
G_debug(3,
"N_alloc_array_2d: FCELL array allocated rows_intern %i cols_intern %i offset %i",
@@ -111,7 +111,7 @@
}
else if (data->type == DCELL_TYPE) {
data->dcell_array =
- (DCELL *) G_calloc(data->rows_intern * data->cols_intern,
+ (DCELL *) G_calloc((size_t) data->rows_intern * data->cols_intern,
sizeof(DCELL));
G_debug(3,
"N_alloc_array_2d: DCELL array allocated rows_intern %i cols_intern %i offset %i",
@@ -751,7 +751,7 @@
if (data->type == FCELL_TYPE) {
data->fcell_array =
- (float *)G_calloc(data->depths_intern * data->rows_intern *
+ (float *)G_calloc((size_t) data->depths_intern * data->rows_intern *
data->cols_intern, sizeof(float));
G_debug(3,
"N_alloc_array_3d: float array allocated rows_intern %i cols_intern %i depths_intern %i offset %i",
@@ -760,7 +760,7 @@
}
else if (data->type == DCELL_TYPE) {
data->dcell_array =
- (double *)G_calloc(data->depths_intern * data->rows_intern *
+ (double *)G_calloc((size_t) data->depths_intern * data->rows_intern *
data->cols_intern, sizeof(double));
G_debug(3,
"N_alloc_array_3d: double array allocated rows_intern %i cols_intern %i depths_intern %i offset %i",
More information about the grass-commit
mailing list