From 65ca742ba4aabda2768ba4423eeaf06d5d46c76e Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 12 Mar 2012 13:11:03 +0000 Subject: Fix bitshifting by a negative amount in PS functions When bitshifting by a negative amount, we should shift right; thanks to Sebras' work in this area, I spotted that we are attempting to shift right by a negative number. --- pdf/pdf_function.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pdf') diff --git a/pdf/pdf_function.c b/pdf/pdf_function.c index a6941ca1..b02ae3c5 100644 --- a/pdf/pdf_function.c +++ b/pdf/pdf_function.c @@ -369,7 +369,7 @@ ps_run(fz_context *ctx, psobj *code, ps_stack *st, int pc) if (i2 > 0 && i2 < 8 * sizeof (i2)) ps_push_int(st, i1 << i2); else if (i2 < 0 && i2 > -8 * sizeof (i2)) - ps_push_int(st, (int)((unsigned int)i1 >> i2)); + ps_push_int(st, (int)((unsigned int)i1 >> -i2)); else ps_push_int(st, i1); break; -- cgit v1.2.3