garouter/gaChannel.c use of unintialized or incorrect variable
This resolution assumes that all records and values of ch->gcr_type are expected to be one of the 3 cases in the switch. The bug it on the first iteration it is possible 'tot' and 'clear' is just not initializaed and on a subsequent iteration it is possible it ot setup to the previous interation values. SonarCloud garouter/gaChannel.c:385:3rd function call argument is an uninitialized value https://sonarcloud.io/project/issues?open=AZJB17fFNGfDNup0RkoE&id=dlmiles_magic
This commit is contained in:
parent
543bd5a5b8
commit
a9b707460b
|
|
@ -381,11 +381,17 @@ gaChannelStats(list)
|
||||||
tot = &gaTotRiverCross;
|
tot = &gaTotRiverCross;
|
||||||
clear = &gaClearRiverCross;
|
clear = &gaClearRiverCross;
|
||||||
break;
|
break;
|
||||||
|
default: /* otherwise tot and clear is not intialized */
|
||||||
|
tot = NULL;
|
||||||
|
clear = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(tot && clear) {
|
||||||
|
gaPinStats(ch->gcr_tPins, ch->gcr_length, tot, clear);
|
||||||
|
gaPinStats(ch->gcr_bPins, ch->gcr_length, tot, clear);
|
||||||
|
gaPinStats(ch->gcr_lPins, ch->gcr_width, tot, clear);
|
||||||
|
gaPinStats(ch->gcr_rPins, ch->gcr_width, tot, clear);
|
||||||
}
|
}
|
||||||
gaPinStats(ch->gcr_tPins, ch->gcr_length, tot, clear);
|
|
||||||
gaPinStats(ch->gcr_bPins, ch->gcr_length, tot, clear);
|
|
||||||
gaPinStats(ch->gcr_lPins, ch->gcr_width, tot, clear);
|
|
||||||
gaPinStats(ch->gcr_rPins, ch->gcr_width, tot, clear);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
numTot = gaTotRiverCross + gaTotNormCross;
|
numTot = gaTotRiverCross + gaTotNormCross;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue