-
Notifications
You must be signed in to change notification settings - Fork 63
Description
In converting Rav1dFrameContext_lf's lr_line_buf field to a Vec and lr_lpf_line to offsets within that allocation (#793) I've run into an issue where we appear to be using a pointer that is offset to before the allocation it originates from.
in lr_stripe (in lr_apply.rs) we're calculating a pointer lpf from one of the pointers in lr_lpf_line. The pointers in lr_lpf_line point into the allocation owned by by lr_line_buf, so lpf can't point outside of that allocation. But in practice I'm finding that we sometimes calculate a value for lpf that points to before the allocation in lr_line_buf.
I confirmed this by adding an assert before the call to lr_fn (where lpf is used) checking that lpf >= lr_line_buf. The issue seems to be only happening when using --framedelay 2, otherwise the assert never triggers.
The version of the logic for calculating lpf was changed in #746 which makes it a bit different than the original C. To determine if that change was the cause of the issue I checked out the commit from before it was merged (e0b5aa4) where the code we have is still the same as the original C as far as I can tell. I was still able to reproduce the issue on this earlier commit so it seems unrelated to the changes in #746.
Since the code we have here is basically the same as the original C, I attempted to reproduce this issue in dav1d to see if it's also present upstream. I was not able to reproduce the issue under the same conditions, so it looks like this is an issue we introduced at some point.