glbinding icon indicating copy to clipboard operation
glbinding copied to clipboard

RingBuffer::resize() issues

Open Tobias1595 opened this issue 5 years ago • 0 comments

Looking into Ringbuffer.inl I noticed that Ringbuffer::resize() simply resizes the internal buffer without any additional checks concerning head and tails. Resizing, especially shrinking a Ringbuffer after it was already used can have results ranging from loss or duplication of entries to crashes due to runtime errors. In short, shrinking a buffer such that the head or the tails are left at invalid (too high) indices should be avoided.

Currently, the RingBuffer is used for logging in glbinding-aux, and resizing this buffer is exposed in logging.h.

Tobias1595 avatar Sep 21 '18 14:09 Tobias1595