Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/lib.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-01-06 22:19:14 +0300
committerJames Almer <jamrial@gmail.com>2021-01-07 04:14:51 +0300
commit57a8294ebfe56039e4f39533ff02708dedeaa45d (patch)
tree7a2cac8151fa13cd5fcf150ec8d3e6a68cfcbc69 /src/lib.c
parent5d7aa26e32f7cf5ae0c5a530084c1a587f162fc1 (diff)
lib: check the integrity of the default picture allocator
Ensure both the allocator and release callbacks are pointing to the default functions, and that no cookie was provided. This prevents the user from configuring a mix of custom and default callbacks.
Diffstat (limited to 'src/lib.c')
-rw-r--r--src/lib.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib.c b/src/lib.c
index 164a50c..af928d6 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -136,9 +136,17 @@ COLD int dav1d_open(Dav1dContext **const c_out, const Dav1dSettings *const s) {
{
goto error;
}
- if (c->allocator.alloc_picture_callback == dav1d_default_picture_alloc) {
+
+ if (c->allocator.alloc_picture_callback == dav1d_default_picture_alloc &&
+ c->allocator.release_picture_callback == dav1d_default_picture_release)
+ {
+ if (c->allocator.cookie) goto error;
if (dav1d_mem_pool_init(&c->picture_pool)) goto error;
c->allocator.cookie = c->picture_pool;
+ } else if (c->allocator.alloc_picture_callback == dav1d_default_picture_alloc ||
+ c->allocator.release_picture_callback == dav1d_default_picture_release)
+ {
+ goto error;
}
/* On 32-bit systems extremely large frame sizes can cause overflows in