diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2012-07-19 01:04:07 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2012-07-23 18:07:04 +0200 |
commit | ec6e8442e47220d0f4e95360ccb94ad3ce6df7f6 (patch) | |
tree | bb603715abaf30e531df23e71274095750990399 /pdf/pdf_function.c | |
parent | 5244fd433d7203a7db26835f738bae18c1bd3651 (diff) | |
download | mupdf-ec6e8442e47220d0f4e95360ccb94ad3ce6df7f6.tar.xz |
Handle sampled pdf function dimensionality
Functions that have excessive dimension sizes will have those sizes
ignored, whereas functions that have too few dimension sizes will
cause an exception.
Diffstat (limited to 'pdf/pdf_function.c')
-rw-r--r-- | pdf/pdf_function.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pdf/pdf_function.c b/pdf/pdf_function.c index 9d0aabd5..5eea4125 100644 --- a/pdf/pdf_function.c +++ b/pdf/pdf_function.c @@ -929,8 +929,10 @@ load_sample_func(pdf_function *func, pdf_document *xref, pdf_obj *dict, int num, func->u.sa.samples = NULL; obj = pdf_dict_gets(dict, "Size"); - if (!pdf_is_array(obj) || pdf_array_len(obj) != func->m) - fz_throw(ctx, "malformed /Size"); + if (pdf_array_len(obj) < func->m) + fz_throw(ctx, "too few sample function dimension sizes"); + if (pdf_array_len(obj) > func->m) + fz_warn(ctx, "too many sample function dimension sizes"); for (i = 0; i < func->m; i++) func->u.sa.size[i] = pdf_to_int(pdf_array_get(obj, i)); @@ -994,7 +996,7 @@ load_sample_func(pdf_function *func, pdf_document *xref, pdf_obj *dict, int num, if (fz_is_eof_bits(stream)) { fz_close(stream); - fz_throw(ctx, "truncated sample stream"); + fz_throw(ctx, "truncated sample function stream"); } switch (bps) |