diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2013-02-19 16:40:12 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2013-02-19 18:46:46 +0100 |
commit | 333b1ef069011af06c8c6821e2091b19e9a5151f (patch) | |
tree | 77d61ee41bcd69b741b7e4fb6e5e7cabcc768d87 /fitz | |
parent | 68169ec2511425d018c03a997f95ebfe043e41f9 (diff) | |
download | mupdf-333b1ef069011af06c8c6821e2091b19e9a5151f.tar.xz |
Bug 693639: fix potential NULL pointer dereference in base_context.c
Thanks to zeniko.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/base_context.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fitz/base_context.c b/fitz/base_context.c index 55d74cc3..ea67e0be 100644 --- a/fitz/base_context.c +++ b/fitz/base_context.c @@ -87,6 +87,8 @@ fz_new_context(fz_alloc_context *alloc, fz_locks_context *locks, unsigned int ma locks = &fz_locks_default; ctx = new_context_phase1(alloc, locks); + if (!ctx) + return NULL; /* Now initialise sections that are shared */ fz_try(ctx) @@ -121,9 +123,14 @@ fz_clone_context_internal(fz_context *ctx) if (ctx == NULL || ctx->alloc == NULL) return NULL; + new_ctx = new_context_phase1(ctx->alloc, ctx->locks); + if (!new_ctx) + return NULL; + /* Inherit AA defaults from old context. */ fz_copy_aa_context(new_ctx, ctx); + /* Keep thread lock checking happy by copying pointers first and locking under new context */ new_ctx->store = ctx->store; new_ctx->store = fz_keep_store_context(new_ctx); @@ -131,5 +138,6 @@ fz_clone_context_internal(fz_context *ctx) new_ctx->glyph_cache = fz_keep_glyph_cache(new_ctx); new_ctx->font = ctx->font; new_ctx->font = fz_keep_font_context(new_ctx); + return new_ctx; } |