Closed RogerJL closed 4 years ago
I have run on unmodified cloned code, using valgrind to find usage of uninitialized memory, array overruns, etc
FACT is - an uninitialized memory is being used to determine if a jump is taken or not on that line. If you think that is OK its on you. (removing the additional comment as it might lead you wrong)
I understand code, when my spine tingles there are usually something strange going on. At first look I might not understand exactly what the code does. But this report was really about an issue found by valgrind, YOU closed the issue without addressing the valgrind one just because of this - it can be related, but it is better to keep the issues apart in one report...
@RogerJL would you be willing to test master:HEAD to see if this is fixed?
That error did not trigger now
Excellent, thanks. We'll consider this one closed.
https://github.com/kassonlab/covid19-epi/blob/3dab2299c1ec68e5ce945486edac4ccf9b23b658/covid19.c#L139
HH_count is limited, but this accesses outside the limit...
(gdb) list 0x40aa80 0x40aa80 is in household_lat_long (covid19.c:139). 134 tmp_lat = lat_locale[HH_count]; 135 tmp_lon = lon_locale[HH_count]; 136 / Scale population density / 137 pop_density_init_num[HH_count] = ceil(pop_density_init_num[HH_count] population / land_pop_total_density); 138 tot_pop_density += pop_density_init_num[HH_count]; 139 if (tot_pop_density > population || ceil(pop_density_init_num[HH_count+1] population / land_pop_total_density) < 0.5) { 140 num_locale = HH_count + 1; 141 } 142 143 // Determine city of each population square. Use city data to determine which schools students attend. Workplaces are placed by county. //
HH_count is limited to number, but here one more is added...