Explorar o código

Prevent alloc problem by casting sizes to size_t

Matthias Vogelgesang %!s(int64=9) %!d(string=hai) anos
pai
achega
147853927c
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      reco.c

+ 1 - 1
reco.c

@@ -355,7 +355,7 @@ run_cached_reconstruction (Params *params, gchar **argv)
         UfoBaseScheduler *sched;
         GError *error = NULL;
 
-        params->cache = g_malloc (params->num_radios * params->width * params->height * sizeof (gfloat));
+        params->cache = g_malloc (((gsize) params->num_radios) * ((gsize) params->width) * ((gsize) params->height) * sizeof (gfloat));
 
         /* fill the cache and reconstruct simultaneously */
         radio_reader = make_task (data->pm, "reader");