diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2022-11-15 14:46:40 +0000 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2022-11-15 15:30:23 +0000 |
commit | 9d0f7852205f9986ec39bfea63d4a006f7f46a31 (patch) | |
tree | 9b56cd55437e5af5cba7c082b7bebe3be1122594 /devices/vector/gdevpdfm.c | |
parent | 2a7d8a1bc1e57deb28fbd42fe02264298eb13ad9 (diff) | |
download | ghostpdl-9d0f7852205f9986ec39bfea63d4a006f7f46a31.tar.gz |
pdfwrite - fix string resizing in pdfmarks.
This came up while working on bug #706078; an intermediate version of
the fix for that code ended up writing 0x0a as '\012', the code in the
pdfmark handling spotted that and replaced it with '\n', which meant
the string needed to be resized.
The string resizing worked fine, but the code did not then alter the
actual 'size' member of the 'cos_value', so it ran off the end when
writing it out.
Diffstat (limited to 'devices/vector/gdevpdfm.c')
-rw-r--r-- | devices/vector/gdevpdfm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/devices/vector/gdevpdfm.c b/devices/vector/gdevpdfm.c index f6b6c51f4..1db558279 100644 --- a/devices/vector/gdevpdfm.c +++ b/devices/vector/gdevpdfm.c @@ -555,10 +555,12 @@ pdfmark_put_ao_pairs(gx_device_pdf * pdev, cos_dict_t *pcd, i += 4, j += 2; } else cstr[j++] = cstr[i++]; - if (j != i) - pcv->contents.chars.data = + if (j != i) { + pcv->contents.chars.data = gs_resize_string(pdev->pdf_memory, cstr, csize, j, "pdfmark_put_ao_pairs"); + pcv->contents.chars.size = j; + } } else if (pdf_key_eq(pair, "/Rect")) { gs_rect rect; char rstr[MAX_RECT_STRING]; |