Browse Source

WDSP: Fix invalid iterator ranges in SPHP flush

Correct std::fill() calls in SPHP::flush() that used x0.end() as the
end iterator when clearing x1, y0, and y1.

The incorrect ranges were likely introduced by a copy/paste error and
resulted in iterator pairs from different containers being used
together, causing undefined behavior.

Use each buffer's own end iterator when clearing its contents.

Detected by cppcheck's mismatchingContainer check.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
chirpmodem-v8.0.0
Robin Getz 4 months ago
parent
commit
95548a92aa
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 6
      wdsp/sphp.cpp

6
wdsp/sphp.cpp

@ -72,9 +72,9 @@ SPHP::SPHP( @@ -72,9 +72,9 @@ SPHP::SPHP(
void SPHP::flush()
{
std::fill(x0.begin(), x0.end(), 0);
std::fill(x1.begin(), x0.end(), 0);
std::fill(y0.begin(), x0.end(), 0);
std::fill(y1.begin(), x0.end(), 0);
std::fill(x1.begin(), x1.end(), 0);
std::fill(y0.begin(), y0.end(), 0);
std::fill(y1.begin(), y1.end(), 0);
}
void SPHP::execute()

Loading…
Cancel
Save