From 00bbb81a2b533990a6cfae85c81511de2dc37fea Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:45:29 -0400 Subject: [PATCH] dsp: Prevent unsafe copying of IIRFilter Explicitly delete the copy constructor and copy assignment operator for IIRFilter to prevent accidental duplication of filter state. Copying an IIRFilter instance could duplicate internal filter state and coefficient references, potentially causing incorrect processing or resource-management problems. Since IIRFilter is not intended to be copied or assigned, prohibit both operations at compile time. cppcheck identified the missing copy constructor and assignment operator with its noCopyConstructor and noOperatorEq warnings. Signed-off-by: Robin Getz --- sdrbase/dsp/iirfilter.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdrbase/dsp/iirfilter.h b/sdrbase/dsp/iirfilter.h index 8734a6592..5164c2420 100644 --- a/sdrbase/dsp/iirfilter.h +++ b/sdrbase/dsp/iirfilter.h @@ -31,6 +31,8 @@ template class IIRFilter public: IIRFilter(const Type *a, const Type *b); ~IIRFilter(); + IIRFilter(const IIRFilter&) = delete; + IIRFilter& operator=(const IIRFilter&) = delete; void setCoeffs(const Type *a, const Type *b); Type run(const Type& sample); @@ -46,6 +48,8 @@ template class IIRFilter public: IIRFilter(const Type *a, const Type *b); ~IIRFilter(); + IIRFilter(const IIRFilter&) = delete; + IIRFilter& operator=(const IIRFilter&) = delete; void setCoeffs(const Type *a, const Type *b); Type run(const Type& sample);