queue2: handle overwriting the current range correctly
@mol
Submitted by Michael Olbrich Link to original bug (#774831)
Description
Created attachment 340491
queue2: handle overwriting the current range correctly
This basically reverts b3802f7a ("queue2:
fix crash deleting current region for small ring buffers") and fixes the
original problem correctly.
Ignoring the current range while checking which ranges must be truncated or
removed is incorrect. With just one range, it it possible, that the offset
of the current range must be adjusted because the corresponding data will
be overwritten.
To fix the original problem, the current range is never removed. Instead it
may be truncated to zero length before the new data is appended.
Note: The test-case from the original commit still works and my test-case (seeking backwards to a position in the current range that was overwritten but not removed from the range) works again. But I'm not 100% sure I got all possible corner cases, so someone with better understanding of queue2 should probably double check this.
Patch 340491, "queue2: handle overwriting the current range correctly":
0001-queue2-handle-overwriting-the-current-range-correctl.patch