console icon indicating copy to clipboard operation
console copied to clipboard

fix(subscriber): changed atomic add to fetch update

Open MilesConn opened this issue 7 months ago • 0 comments

Hi I can file a bug if that's needed but on my project (I can try and make an MVE) I kept running into an out of bounds panic originating from

for cs in &self.ptrs[start..len] {

I assumed this was possible due to multiple calls to fetch_add incrementing and thus putting len temporarily in a bad state that could allow an out of bound access. The other solution I thought of would've been len.min(MAX_CALLSITES) so up to you which you prefer. I should note, I'm not super familiar with atomics so I'm unsure if I did it right.

While I don't have an MVE using this modified code with my project I no longer saw the panic. Let me know if there's anything else I can do and thanks for all your hard work! :)

MilesConn avatar May 28 '25 00:05 MilesConn