USEPA / Stormwater-Management-Model

Dynamic hydrology-hydraulic water quality simulation model
237 stars 175 forks source link

Pointer to length for system series must be dereferenced for looping #128

Closed cbuahin closed 1 year ago

cbuahin commented 1 year ago

There appears to be a bug in the SWMM output file reader here. Shouldn't the length pointer be dereferenced before being used in the loop? @michaeltryby, if you can confirm, I will make a PR.

bemcdonnell commented 1 year ago

@cbuahin I agree that it's a bug. SMO_getSystemSeries is not under any unit test https://github.com/USEPA/Stormwater-Management-Model/blob/develop/tests/outfile/test_output.cpp.

bemcdonnell commented 1 year ago

@cbuahin isn't it just a simple change here? most of the other functions have that implementation

https://github.com/USEPA/Stormwater-Management-Model/blob/b7aff8c8b4c399889204a63bc91cd86ee177885f/src/outfile/swmm_output.c#LL673C34-L673C34

for (k = 0; k < len; k++)

cbuahin commented 1 year ago

That would seem to be the solution. Yeah simple fix. The length variable is meant to be an output.