Skip to content

Only set Dav1dRef's data field in dav1d_ref_create

Michael Bradshaw requested to merge mjbshaw/dav1d:const2 into master

This is the alternative I mentioned in !527 (closed) (which I assumed would be closed).

This slightly revises how Dav1dRef's data field gets set. Currently, data is set if ptr and user_data point to the same thing. This will unintentionally cause the writeable data field to point to potentially readonly memory (in the case that the user calls dav1d_data_wrap with buf == user_data).

With this merge request, data will only be set if dav1d_ref_create is called. Additionally, dav1d_ref_is_writable will make sure the writable data pointer is set.

Merge request reports