summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-08-18 12:29:08 +0000
committerTor Andersson <tor@ghostscript.com>2010-08-18 12:29:08 +0000
commit6069954c7307c3b7596057a1f4a462c617ab2bbf (patch)
tree2a73cc4160f3a8cda10753917eed73a19828f120 /fitz
parentfd93fd4bdb93cc315bc99076c5d7744171c4d133 (diff)
downloadmupdf-6069954c7307c3b7596057a1f4a462c617ab2bbf.tar.xz
Don't print XML metacharacters in attribute strings in dev_trace.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/res_text.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fitz/res_text.c b/fitz/res_text.c
index 60b7b43f..369e7e2a 100644
--- a/fitz/res_text.c
+++ b/fitz/res_text.c
@@ -111,6 +111,11 @@ fz_addtext(fz_text *text, int gid, int ucs, float x, float y)
text->len++;
}
+static int isxmlmeta(int c)
+{
+ return c < 32 || c >= 128 || c == '&' || c == '<' || c == '>' || c == '\'' || c == '"';
+}
+
void fz_debugtext(fz_text *text, int indent)
{
int i, n;
@@ -118,7 +123,7 @@ void fz_debugtext(fz_text *text, int indent)
{
for (n = 0; n < indent; n++)
putchar(' ');
- if (text->els[i].ucs >= 32 && text->els[i].ucs < 128)
+ if (!isxmlmeta(text->els[i].ucs))
printf("<g ucs=\"%c\" gid=\"%d\" x=\"%g\" y=\"%g\" />\n",
text->els[i].ucs, text->els[i].gid, text->els[i].x, text->els[i].y);
else