diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-02-21 16:07:20 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-02-21 16:46:43 +0100 |
commit | 273effeec2469a97998c7d2c0147007e6bb04bf2 (patch) | |
tree | a8b1ac17505075784b2497b27357f9b46d60419c | |
parent | 79c47af457f7b3ac8c67ffc17e7f824ad0266304 (diff) | |
download | mupdf-273effeec2469a97998c7d2c0147007e6bb04bf2.tar.xz |
The 'count' array in pdf_annot_set_ink_list takes number of points.
Not number of coordinates.
-rw-r--r-- | source/tools/murun.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source/tools/murun.c b/source/tools/murun.c index bff3cc61..90b7cd17 100644 --- a/source/tools/murun.c +++ b/source/tools/murun.c @@ -4059,13 +4059,13 @@ static void ffi_PDFAnnotation_setInkList(js_State *J) nv = 0; for (i = 0; i < n; ++i) { js_getindex(J, 1, i); - nv += js_getlength(J, -1); + nv += js_getlength(J, -1) / 2; js_pop(J, 1); } fz_try(ctx) { counts = fz_malloc(ctx, n * sizeof(int)); - points = fz_malloc(ctx, nv * sizeof(float)); + points = fz_malloc(ctx, nv * 2 * sizeof(float)); } fz_catch(ctx) { fz_free(ctx, counts); fz_free(ctx, points); @@ -4079,11 +4079,10 @@ static void ffi_PDFAnnotation_setInkList(js_State *J) } for (i = v = 0; i < n; ++i) { js_getindex(J, 1, i); - counts[i] = js_getlength(J, -1); - for (k = 0; k < counts[i]; ++k) { + counts[i] = js_getlength(J, -1) / 2; + for (k = 0; k < counts[i] * 2; ++k) { js_getindex(J, -1, k); - if (v < nv) - points[v++] = js_tonumber(J, -1); + points[v++] = js_tonumber(J, -1); js_pop(J, 1); } js_pop(J, 1); |