From 31ee803659cc23304fe88eef429a69671abc3709 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:46:53 -0400 Subject: [PATCH] util: Prevent unsafe copying of DoubleBufferFIFO Explicitly delete the copy constructor and copy assignment operator for DoubleBufferFIFO to prevent accidental duplication of its data buffer. The destructor deletes m_data with delete[]. A shallow copy would cause multiple instances to own the same buffer, potentially resulting in double deletion and memory corruption. Since DoubleBufferFIFO manages its buffer directly, prohibit copying and assignment at compile time. cppcheck identified the missing copy constructor and assignment operator with its noCopyConstructor and noOperatorEq warnings. Signed-off-by: Robin Getz --- sdrbase/util/doublebufferfifo.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdrbase/util/doublebufferfifo.h b/sdrbase/util/doublebufferfifo.h index d4a68faf2..5cf59df9d 100644 --- a/sdrbase/util/doublebufferfifo.h +++ b/sdrbase/util/doublebufferfifo.h @@ -35,6 +35,9 @@ public: delete[] m_data; } + DoubleBufferFIFO(const DoubleBufferFIFO&) = delete; + DoubleBufferFIFO& operator=(const DoubleBufferFIFO&) = delete; + void resize(int size) { delete[] m_data;