summaryrefslogtreecommitdiff
path: root/source/fitz/load-jpeg.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2018-05-09 22:15:11 +0800
committerSebastian Rasmussen <sebras@gmail.com>2018-05-10 01:16:28 +0800
commite6dfa88940aec6820411fc0d013c2bd0faa5547e (patch)
tree81c7fc7c0a74e10463803b7dd625edccd3fc0f37 /source/fitz/load-jpeg.c
parent8fb0e3989a6867b67d5cafb04b622701d383a832 (diff)
downloadmupdf-e6dfa88940aec6820411fc0d013c2bd0faa5547e.tar.xz
Use fz_malloc_no_throw() in JPEG/DCT decoder.
Suppose an application that uses MuPDF implements its own allocator that limits the amount of memory that may be allocated. When that condition occurs fz_malloc() will throw an exception, this exception would then be thrown right back to MuPDF without allowing for libjpeg to free any of the memory it has allocated. After this commit fz_malloc_no_throw() is called, which under the same conditions would simply return NULL. allowing for libjpeg to free what ever allocations it has done, and return to MuPDF with an error just like before.
Diffstat (limited to 'source/fitz/load-jpeg.c')
-rw-r--r--source/fitz/load-jpeg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/fitz/load-jpeg.c b/source/fitz/load-jpeg.c
index 87b32431..3db94a6b 100644
--- a/source/fitz/load-jpeg.c
+++ b/source/fitz/load-jpeg.c
@@ -24,7 +24,7 @@ static void *
fz_jpg_mem_alloc(j_common_ptr cinfo, size_t size)
{
fz_context *ctx = JZ_CTX_FROM_CINFO(cinfo);
- return fz_malloc(ctx, size);
+ return fz_malloc_no_throw(ctx, size);
}
static void