summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2013-12-14 13:42:26 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2013-12-14 13:42:26 +0000
commitfbb8ecebf32e3dc91c173f8930c022cbb07e328e (patch)
treeb9ac2a6a0fbb0a1cd843bcd61e26c3372eb706c8 /Build/source
parentd6b74aa0480e121e87775225221c87cb476f2b3f (diff)
Guarantee that mline in is_pdfm_mapline(mline) is a zero-ended string
git-svn-id: svn://tug.org/texlive/trunk@32410 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/dvipdfm-x/ChangeLog5
-rw-r--r--Build/source/texk/dvipdfm-x/spc_pdfm.c27
-rw-r--r--Build/source/texk/dvipdfm-x/spc_xtx.c31
3 files changed, 24 insertions, 39 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog
index fed6611742e..8e253e6f185 100644
--- a/Build/source/texk/dvipdfm-x/ChangeLog
+++ b/Build/source/texk/dvipdfm-x/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-14 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * spc_xtx.c: Guarantee that mline in is_pdfm_mapline(mline) is a
+ zero-ended string when called by spc_handler_xtx_fontmapline().
+
2013-12-13 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* spc_pdfm.c: Guarantee that mline in is_pdfm_mapline(mline) is a
diff --git a/Build/source/texk/dvipdfm-x/spc_pdfm.c b/Build/source/texk/dvipdfm-x/spc_pdfm.c
index 7317f5d3aad..c4550e32a80 100644
--- a/Build/source/texk/dvipdfm-x/spc_pdfm.c
+++ b/Build/source/texk/dvipdfm-x/spc_pdfm.c
@@ -1801,7 +1801,8 @@ spc_handler_pdfm_mapline (struct spc_env *spe, struct spc_arg *ap)
char *map_name, opchr;
int error = 0;
static char buffer[1024];
- char *p, *q;
+ const char *p;
+ char *q;
skip_white(&ap->curptr, ap->endptr);
if (ap->curptr >= ap->endptr) {
@@ -1826,25 +1827,8 @@ spc_handler_pdfm_mapline (struct spc_env *spe, struct spc_arg *ap)
error = -1;
}
break;
- case '+':
- p = (char *)ap->curptr;
- q = buffer;
- while (p < ap->endptr)
- *q++ = *p++;
- *q = '\0';
- mrec = NEW(1, fontmap_rec);
- pdf_init_fontmap_record(mrec);
- error = pdf_read_fontmap_line(mrec, buffer, (long) (ap->endptr - ap->curptr), is_pdfm_mapline(buffer));
- if (error)
- spc_warn(spe, "Invalid fontmap line.");
- else {
- pdf_append_fontmap_record(mrec->map_name, mrec);
- }
- pdf_clear_fontmap_record(mrec);
- RELEASE(mrec);
- break;
default:
- p = (char *)ap->curptr;
+ p = ap->curptr;
q = buffer;
while (p < ap->endptr)
*q++ = *p++;
@@ -1854,9 +1838,10 @@ spc_handler_pdfm_mapline (struct spc_env *spe, struct spc_arg *ap)
error = pdf_read_fontmap_line(mrec, buffer, (long) (ap->endptr - ap->curptr), is_pdfm_mapline(buffer));
if (error)
spc_warn(spe, "Invalid fontmap line.");
- else {
+ else if (opchr == '+')
+ pdf_append_fontmap_record(mrec->map_name, mrec);
+ else
pdf_insert_fontmap_record(mrec->map_name, mrec);
- }
pdf_clear_fontmap_record(mrec);
RELEASE(mrec);
break;
diff --git a/Build/source/texk/dvipdfm-x/spc_xtx.c b/Build/source/texk/dvipdfm-x/spc_xtx.c
index ed0b667f8c2..c5de603922e 100644
--- a/Build/source/texk/dvipdfm-x/spc_xtx.c
+++ b/Build/source/texk/dvipdfm-x/spc_xtx.c
@@ -201,6 +201,9 @@ spc_handler_xtx_fontmapline (struct spc_env *spe, struct spc_arg *ap)
fontmap_rec *mrec;
char *map_name, opchr;
int error = 0;
+ static char buffer[1024];
+ const char *p;
+ char *q;
skip_white(&ap->curptr, ap->endptr);
if (ap->curptr >= ap->endptr) {
@@ -225,29 +228,21 @@ spc_handler_xtx_fontmapline (struct spc_env *spe, struct spc_arg *ap)
error = -1;
}
break;
- case '+':
- mrec = NEW(1, fontmap_rec);
- pdf_init_fontmap_record(mrec);
- error = pdf_read_fontmap_line(mrec, ap->curptr, (long) (ap->endptr - ap->curptr),
- is_pdfm_mapline(ap->curptr));
- if (error)
- spc_warn(spe, "Invalid fontmap line.");
- else {
- pdf_append_fontmap_record(mrec->map_name, mrec);
- }
- pdf_clear_fontmap_record(mrec);
- RELEASE(mrec);
- break;
default:
+ p = ap->curptr;
+ q = buffer;
+ while (p < ap->endptr)
+ *q++ = *p++;
+ *q = '\0';
mrec = NEW(1, fontmap_rec);
pdf_init_fontmap_record(mrec);
- error = pdf_read_fontmap_line(mrec, ap->curptr, (long) (ap->endptr - ap->curptr),
- is_pdfm_mapline(ap->curptr));
+ error = pdf_read_fontmap_line(mrec, buffer, (long) (ap->endptr - ap->curptr), is_pdfm_mapline(buffer));
if (error)
spc_warn(spe, "Invalid fontmap line.");
- else {
+ else if (opchr == '+')
+ pdf_append_fontmap_record(mrec->map_name, mrec);
+ else
pdf_insert_fontmap_record(mrec->map_name, mrec);
- }
pdf_clear_fontmap_record(mrec);
RELEASE(mrec);
break;
@@ -255,7 +250,7 @@ spc_handler_xtx_fontmapline (struct spc_env *spe, struct spc_arg *ap)
if (!error)
ap->curptr = ap->endptr;
- return 0;
+ return 0;
}
static int