summaryrefslogtreecommitdiff
path: root/pdf/pdf_form.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-06-21 19:21:31 +0100
committerRobin Watts <robin.watts@artifex.com>2012-06-21 19:21:31 +0100
commitd23dae61660efa3b88553988935348e4a8cd2143 (patch)
tree9c7b822e643687958e512f960ce580d06fd654ef /pdf/pdf_form.c
parent57ef7adeab09993a203b74245ab1caeed76f98b1 (diff)
downloadmupdf-d23dae61660efa3b88553988935348e4a8cd2143.tar.xz
Add fz_buffer_cat_pdf_string function to avoid Bug 693143.
Avoid overflowing fz_buffer_printf by using a dedicated string output function; this also solves potential problems with us not escaping chars in strings correctly. Unfortunately this doesn't completely cure the bug as we run straight into problems in the lexer.
Diffstat (limited to 'pdf/pdf_form.c')
-rw-r--r--pdf/pdf_form.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pdf/pdf_form.c b/pdf/pdf_form.c
index 8d8f598e..45510aac 100644
--- a/pdf/pdf_form.c
+++ b/pdf/pdf_form.c
@@ -78,7 +78,7 @@ static const char *fmt_n = "n\n";
static const char *fmt_BT = "BT\n";
static const char *fmt_Tm = "%1.2f %1.2f %1.2f %1.2f %1.2f %1.2f Tm\n";
static const char *fmt_Td = "%f %f Td\n";
-static const char *fmt_Tj = "(%s) Tj\n";
+static const char *fmt_Tj = " Tj\n";
static const char *fmt_ET = "ET\n";
static const char *fmt_Q = "Q\n";
static const char *fmt_EMC = "EMC\n";
@@ -422,7 +422,8 @@ static void fzbuf_print_text(fz_context *ctx, fz_buffer *fzbuf, fz_rect *clip, f
if (tm)
fz_buffer_printf(ctx, fzbuf, fmt_Tm, tm->a, tm->b, tm->c, tm->d, tm->e, tm->f);
- fz_buffer_printf(ctx, fzbuf, fmt_Tj, text);
+ fz_buffer_cat_pdf_string(ctx, fzbuf, text);
+ fz_buffer_printf(ctx, fzbuf, fmt_Tj);
fz_buffer_printf(ctx, fzbuf, fmt_ET);
fz_buffer_printf(ctx, fzbuf, fmt_Q);
}