Skip to content

Negative indices in unfull buffers unsafely access memory #14

@fpdotmonkey

Description

@fpdotmonkey

In a partly-full buffer, if you take a negative index, it will refer that index to the end of the full length of the buffer as apposed to the end of the full portion of the buffer.

from numpy_ringbuffer import RingBuffer
r = RingBuffer(10)
for i in range(5):
    r.append(i)
print(r[-1])
# 3.5097786643241087e+64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions