summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2015-07-26 14:01:30 +0200
committerSebastian Rasmussen <sebras@gmail.com>2015-07-27 14:54:26 +0200
commit29b021ef37766520865a387af59a4ba6f97deefd (patch)
tree0bdeb3790ff9d5dbe3294145fd6bad14f9f24f11 /source
parentaf0550ab30b7854622b48798b0eaac02d97106f3 (diff)
downloadmupdf-29b021ef37766520865a387af59a4ba6f97deefd.tar.xz
Handle out of range line join and line cap styles.
Previously these operators accepted out of range values which triggered asserts in the rendering code.
Diffstat (limited to 'source')
-rw-r--r--source/pdf/pdf-interpret.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/pdf/pdf-interpret.c b/source/pdf/pdf-interpret.c
index e1df2c68..f876925a 100644
--- a/source/pdf/pdf-interpret.c
+++ b/source/pdf/pdf-interpret.c
@@ -350,11 +350,11 @@ pdf_process_extgstate(fz_context *ctx, pdf_processor *proc, pdf_csi *csi, pdf_ob
obj = pdf_dict_get(ctx, dict, PDF_NAME_LC);
if (pdf_is_int(ctx, obj) && proc->op_J)
- proc->op_J(ctx, proc, pdf_to_int(ctx, obj));
+ proc->op_J(ctx, proc, fz_clampi(pdf_to_int(ctx, obj), 0, 2));
obj = pdf_dict_get(ctx, dict, PDF_NAME_LJ);
if (pdf_is_int(ctx, obj) && proc->op_j)
- proc->op_j(ctx, proc, pdf_to_int(ctx, obj));
+ proc->op_j(ctx, proc, fz_clampi(pdf_to_int(ctx, obj), 0, 2));
obj = pdf_dict_get(ctx, dict, PDF_NAME_ML);
if (pdf_is_number(ctx, obj) && proc->op_M)
@@ -780,8 +780,8 @@ pdf_process_keyword(fz_context *ctx, pdf_processor *proc, pdf_csi *csi, fz_strea
/* general graphics state */
case A('w'): if (proc->op_w) proc->op_w(ctx, proc, s[0]); break;
- case A('j'): if (proc->op_j) proc->op_j(ctx, proc, s[0]); break;
- case A('J'): if (proc->op_J) proc->op_J(ctx, proc, s[0]); break;
+ case A('j'): if (proc->op_j) proc->op_j(ctx, proc, fz_clampi(s[0], 0, 2)); break;
+ case A('J'): if (proc->op_J) proc->op_J(ctx, proc, fz_clampi(s[0], 0, 2)); break;
case A('M'): if (proc->op_M) proc->op_M(ctx, proc, s[0]); break;
case A('d'): if (proc->op_d) proc->op_d(ctx, proc, csi->obj, s[0]); break;
case B('r','i'): if (proc->op_ri) proc->op_ri(ctx, proc, csi->name); break;