sourcestats: assert dump file is loaded with no accumulated samples

This commit is contained in:
Miroslav Lichvar 2014-04-29 11:31:21 +02:00
parent ed96b4d49d
commit be3439fef1

View file

@ -770,6 +770,8 @@ SST_LoadFromFile(SST_Stats inst, FILE *in)
unsigned long sec, usec;
double weight;
assert(!inst->n_samples);
if (fgets(line, sizeof(line), in) &&
sscanf(line, "%d", &inst->n_samples) == 1 &&
inst->n_samples > 0 && inst->n_samples <= MAX_SAMPLES) {