cbiffle/lilos

Potential bug in spsc::Queue::drop

OscarFKE opened this issue · 1 comments

let mut t = self.head.load(Ordering::SeqCst);

The loop to drop the values of the elements is checking if head != head instead of head != tail. I'm new to rust so I'm unsure of the consequences of not dropping the elements, I'm guessing potential memory corruption bugs?

Good catch! I believe this is a bug, and appears to date from the original version of spsc in 2021.

Failing to drop the elements may leak memory (if you're using a heap) or resources (in the more general case), but doesn't tend to corrupt memory, which is probably why I hadn't noticed this.

I've written a reproduction test case and will use it as a regression test for the fix here in a bit.