浏览代码

gpde lib: fix integer overflow

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@53137 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 12 年之前
父节点
当前提交
73b9591603
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 5 5
      lib/gpde/N_arrays.c

+ 5 - 5
lib/gpde/N_arrays.c

@@ -94,7 +94,7 @@ N_array_2d *N_alloc_array_2d(int cols, int rows, int offset, int type)
 
     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 @@ N_array_2d *N_alloc_array_2d(int cols, int rows, int offset, int type)
     }
     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 @@ N_array_2d *N_alloc_array_2d(int cols, int rows, int offset, int type)
     }
     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 @@ N_array_3d *N_alloc_array_3d(int cols, int rows, int depths, int offset,
 
     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 @@ N_array_3d *N_alloc_array_3d(int cols, int rows, int depths, int offset,
     }
     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",