forked from pool/transfig
Update to fig2dev 3.2.8
OBS-URL: https://build.opensuse.org/package/show/Publishing/transfig?expand=0&rev=67
This commit is contained in:
parent
be676d2f8e
commit
aa6675647f
79
00cded.patch
79
00cded.patch
@ -1,79 +0,0 @@
|
||||
From 00cdedac7a0b029846dee891769a1e77df83a01b Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Sat, 25 Jan 2020 15:04:59 +0100
|
||||
Subject: [PATCH] Accept -1 as default TeX font, fixes ticket #81
|
||||
|
||||
The default for PostScript fonts is -1, for TeX fonts 0. Accepting -1 for TeX
|
||||
fonts lead to out-of-bound read. Now, -1 for TeX fonts is converted to 0.
|
||||
---
|
||||
fig2dev/dev/genpict2e.c | 9 +++++----
|
||||
fig2dev/dev/gentikz.c | 9 +++++----
|
||||
fig2dev/tests/read.at | 10 ++++++++++
|
||||
3 files changed, 20 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git fig2dev/dev/genpict2e.c fig2dev/dev/genpict2e.c
|
||||
index 6ab442e..dd6fd95 100644
|
||||
--- fig2dev/dev/genpict2e.c
|
||||
+++ fig2dev/dev/genpict2e.c
|
||||
@@ -2223,11 +2223,12 @@ put_font(F_text *t)
|
||||
}
|
||||
|
||||
if (psfont_text(t))
|
||||
- fprintf(tfp, "\\usefont%s",
|
||||
- texpsfonts[t->font <= MAX_PSFONT ? t->font + 1 : 0]);
|
||||
+ fprintf(tfp, "\\usefont%s", texpsfonts[t->font <= MAX_PSFONT ?
|
||||
+ t->font + 1 : 0]);
|
||||
else
|
||||
- fprintf(tfp, "\\normalfont%s ",
|
||||
- texfonts[t->font <= MAX_FONT ? t->font : MAX_FONT - 1]);
|
||||
+ /* Default psfont is -1, default texfont 0, also accept -1. */
|
||||
+ fprintf(tfp, "\\normalfont%s ", texfonts[t->font <= MAX_FONT ?
|
||||
+ (t->font >= 0 ? t->font : 0) : MAX_FONT - 1]);
|
||||
}
|
||||
|
||||
void
|
||||
diff --git fig2dev/dev/gentikz.c fig2dev/dev/gentikz.c
|
||||
index 797ca1c..b374e10 100644
|
||||
--- fig2dev/dev/gentikz.c
|
||||
+++ fig2dev/dev/gentikz.c
|
||||
@@ -1772,11 +1772,12 @@ put_font(F_text *t)
|
||||
}
|
||||
|
||||
if (psfont_text(t))
|
||||
- fprintf(tfp, "\\usefont%s",
|
||||
- texpsfonts[t->font <= MAX_PSFONT ? t->font + 1 : 0]);
|
||||
+ fprintf(tfp, "\\usefont%s", texpsfonts[t->font <= MAX_PSFONT ?
|
||||
+ t->font + 1 : 0]);
|
||||
else
|
||||
- fprintf(tfp, "\\normalfont%s ",
|
||||
- texfonts[t->font <= MAX_FONT ? t->font : MAX_FONT - 1]);
|
||||
+ /* Default psfont is -1, default texfont 0, also accept -1. */
|
||||
+ fprintf(tfp, "\\normalfont%s ", texfonts[t->font <= MAX_FONT ?
|
||||
+ (t->font >= 0 ? t->font : 0) : MAX_FONT - 1]);
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git fig2dev/tests/read.at fig2dev/tests/read.at
|
||||
index 9b34bfb..331afb5 100644
|
||||
--- fig2dev/tests/read.at
|
||||
+++ fig2dev/tests/read.at
|
||||
@@ -406,6 +406,16 @@ EOF
|
||||
])
|
||||
AT_CLEANUP
|
||||
|
||||
+AT_SETUP([allow tex font -1, ticket #81])
|
||||
+AT_DATA([text.fig], [FIG_FILE_TOP
|
||||
+4 0 0 50 -1 -1 12 0.0 0 150 405 0 0 Text\001
|
||||
+])
|
||||
+AT_CHECK([fig2dev -L pict2e text.fig
|
||||
+], 0, ignore)
|
||||
+AT_CHECK([fig2dev -L tikz text.fig
|
||||
+], 0, ignore)
|
||||
+AT_CLEANUP
|
||||
+
|
||||
AT_BANNER([Dynamically allocate picture file name.])
|
||||
|
||||
AT_SETUP([prepend fig file path to picture file name])
|
||||
--
|
||||
2.16.4
|
||||
|
32
100e27.patch
32
100e27.patch
@ -1,32 +0,0 @@
|
||||
From 100e2789f8106f9cc0f7e4319c4ee7bda076c3ac Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Sun, 16 Feb 2020 13:25:03 +0100
|
||||
Subject: [PATCH] Modify commit [3165d8]: Use tangent, not secant
|
||||
|
||||
Use the tangent, not a secant, for short arrows on arcs.
|
||||
---
|
||||
fig2dev/bound.c | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git fig2dev/bound.c fig2dev/bound.c
|
||||
index d305ab9..ea97461 100644
|
||||
--- fig2dev/bound.c
|
||||
+++ fig2dev/bound.c
|
||||
@@ -1102,12 +1102,10 @@ compute_arcarrow_angle(double x1, double y1, double x2, double y2,
|
||||
/* add this to the length */
|
||||
h += lpt;
|
||||
|
||||
- /* radius too small for this method, use normal method */
|
||||
- if (h > 2.0*r) {
|
||||
+ /* secant would be too large or too small */
|
||||
+ if (h > 2.0*r || h < 0.01*r) {
|
||||
arc_tangent_int(x1,y1,x2,y2,direction,x,y);
|
||||
return;
|
||||
- } else if (h < thick) {
|
||||
- h = thick;
|
||||
}
|
||||
|
||||
beta=atan2(dy,dx);
|
||||
--
|
||||
2.16.4
|
||||
|
63
2f8d1a.patch
63
2f8d1a.patch
@ -1,63 +0,0 @@
|
||||
From 2f8d1ae9763dcdc99b88a2b14849fe37174bcd69 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Wed, 29 Jan 2020 22:53:32 +0100
|
||||
Subject: [PATCH] Reject out-of-range pattern, ticket #63
|
||||
|
||||
---
|
||||
fig2dev/object.h | 2 +-
|
||||
fig2dev/tests/read.at | 19 +++++++++++++++++--
|
||||
2 files changed, 18 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git fig2dev/object.h fig2dev/object.h
|
||||
index 8464010..6830b13 100644
|
||||
--- fig2dev/object.h
|
||||
+++ fig2dev/object.h
|
||||
@@ -61,7 +61,7 @@ typedef struct f_comment {
|
||||
o->style < SOLID_LINE || o->style > DASH_3_DOTS_LINE || \
|
||||
o->thickness < 0 || o->depth < 0 || o->depth > 999 || \
|
||||
o->fill_style < UNFILLED || \
|
||||
- o->fill_style > NUMSHADES + NUMTINTS + NUMPATTERNS || \
|
||||
+ o->fill_style >= NUMSHADES + NUMTINTS + NUMPATTERNS || \
|
||||
o->style_val < 0.0
|
||||
|
||||
typedef struct f_ellipse {
|
||||
|diff --git fig2dev/tests/read.at fig2dev/tests/read.at
|
||||
|index 2d066e4..bf117ee 100644
|
||||
|--- fig2dev/tests/read.at
|
||||
|+++ fig2dev/tests/read.at
|
||||
|@@ -421,15 +421,30 @@ AT_CLEANUP
|
||||
|
|
||||
| AT_SETUP([reject ASCII NUL ('\0') in input, ticket #80])
|
||||
| AT_KEYWORDS([read.c svg])
|
||||
|-AT_CHECK([fig2dev -L svg $srcdir/data/text_w_ascii0.fig], 1, ignore, ignore)
|
||||
|+AT_CHECK([fig2dev -L svg $srcdir/data/text_w_ascii0.fig],
|
||||
|+1, ignore, [ASCII NUL ('\0') in line 11.
|
||||
|+])
|
||||
| AT_CLEANUP
|
||||
|
|
||||
| AT_SETUP([reject out of range text angle, ticket #76])
|
||||
|+AT_KEYWORDS([read.c pstricks])
|
||||
| AT_CHECK([fig2dev -L pstricks <<EOF
|
||||
| FIG_FILE_TOP
|
||||
| 4 0 0 50 -1 -1 12 9e26 0 150 405 0 0 Very slanted text\001
|
||||
| EOF
|
||||
|-], 1, ignore, ignore)
|
||||
|+], 1, ignore, [Invalid text object at line 10.
|
||||
|+])
|
||||
|+AT_CLEANUP
|
||||
|+
|
||||
|+AT_SETUP([reject out-of-range pattern fills, ticket #63])
|
||||
|+AT_KEYWORDS([read.c cgm])
|
||||
|+AT_CHECK([fig2dev -L cgm <<EOF
|
||||
|+FIG_FILE_TOP
|
||||
|+2 3 0 0 0 7 50 -1 63 0.000 0 0 -1 0 0 4
|
||||
|+ 0 0 1200 0 600 800 0 0
|
||||
|+EOF
|
||||
|+], 1, ignore, [Invalid line object at line 10.
|
||||
|+])
|
||||
| AT_CLEANUP
|
||||
|
|
||||
| AT_BANNER([Dynamically allocate picture file name.])
|
||||
--
|
||||
2.16.4
|
||||
|
63
3065eb.patch
63
3065eb.patch
@ -1,63 +0,0 @@
|
||||
From 3065ebc14bb96506429b4ebde3aeb3793c72a66d Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Sun, 16 Feb 2020 18:54:01 +0100
|
||||
Subject: [PATCH] Allow last line of file lacking eol char, #83, #84
|
||||
|
||||
If the last line of a fig file does not end with a newline, the code parsing
|
||||
the input could read beyond the allocated buffer. This commit fixes the parsing
|
||||
at two locations in the code, one in string parsing, the second where sequences
|
||||
of a backslash and octal digits are converted to characters.
|
||||
---
|
||||
fig2dev/read.c | 6 ++++--
|
||||
fig2dev/tests/read.at | 11 +++++++++++
|
||||
2 files changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
--- fig2dev/read.c
|
||||
+++ fig2dev/read.c 2020-09-30 10:46:34.214234522 +0000
|
||||
@@ -1483,6 +1483,8 @@ read_textobject(FILE *fp, char **restric
|
||||
|
||||
len = strlen(start);
|
||||
start[len++] = '\n'; /* put back the newline */
|
||||
+ start[len] = '\0'; /* and terminate the string,
|
||||
+ in case nothing else is found */
|
||||
|
||||
/* allocate plenty of space */
|
||||
next = malloc(len + BUFSIZ);
|
||||
@@ -1491,7 +1493,7 @@ read_textobject(FILE *fp, char **restric
|
||||
free(t);
|
||||
return NULL;
|
||||
}
|
||||
- memcpy(next, start, len);
|
||||
+ memcpy(next, start, len + 1);
|
||||
|
||||
while ((chars = getline(line, line_len, fp)) != -1) {
|
||||
++(*line_no);
|
||||
@@ -1525,7 +1527,7 @@ read_textobject(FILE *fp, char **restric
|
||||
len = end - start;
|
||||
l = len;
|
||||
while (c[l] != '\0') {
|
||||
- if (c[l] == '\\') {
|
||||
+ if (c[l] == '\\' && c[l+1] != '\0') {
|
||||
/* convert 3 digit octal value */
|
||||
if (isdigit(c[l+1]) && c[l+2] != '\0' &&
|
||||
c[l+3] != '\0') {
|
||||
--- fig2dev/tests/read.at
|
||||
+++ fig2dev/tests/read.at 2020-09-30 10:46:34.262233620 +0000
|
||||
@@ -416,6 +416,17 @@ AT_CHECK([fig2dev -L tikz text.fig
|
||||
], 0, ignore)
|
||||
AT_CLEANUP
|
||||
|
||||
+AT_SETUP([allow files end without eol, tickets #83, #84])
|
||||
+AT_KEYWORDS([read.c])
|
||||
+AT_CHECK([AS_ECHO_N(["FIG_FILE_TOP
|
||||
+4 0 0 50 0 -1 12 0 0 150 405 0 0 No end-of-line here -->"]) | \
|
||||
+ fig2dev -L box], 0, ignore)
|
||||
+AT_CHECK([AS_ECHO_N(["FIG_FILE_TOP
|
||||
+4 0 0 50 0 -1 12 0 0 150 405 0 0 Start string
|
||||
+No end-of-line after one backslash --> \\"]) | \
|
||||
+ fig2dev -L box], 0, ignore)
|
||||
+AT_CLEANUP
|
||||
+
|
||||
AT_BANNER([Dynamically allocate picture file name.])
|
||||
|
||||
AT_SETUP([prepend fig file path to picture file name])
|
75
3165d8.patch
75
3165d8.patch
@ -1,75 +0,0 @@
|
||||
From 3165d86c31c6323913239fdc6460be6ababd3826 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Tue, 4 Feb 2020 20:58:27 +0100
|
||||
Subject: [PATCH] Allow arrows with zero length on arcs, ticket #74
|
||||
|
||||
---
|
||||
fig2dev/bound.c | 9 +++++----
|
||||
fig2dev/tests/output.at | 10 +++++++++-
|
||||
2 files changed, 14 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git fig2dev/bound.c fig2dev/bound.c
|
||||
index ce7f4d1..d305ab9 100644
|
||||
--- fig2dev/bound.c
|
||||
+++ fig2dev/bound.c
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (c) 1985 Supoj Sutanthavibul
|
||||
* Copyright (c) 1991 Micah Beck
|
||||
* Parts Copyright (c) 1989-2015 by Brian V. Smith
|
||||
- * Parts Copyright (c) 2015-2019 Thomas Loimer
|
||||
+ * Parts Copyright (c) 2015-2020 Thomas Loimer
|
||||
*
|
||||
* Any party obtaining a copy of these files is granted, free of charge, a
|
||||
* full and unrestricted irrevocable, world-wide, paid up, royalty-free,
|
||||
@@ -1095,9 +1095,8 @@ compute_arcarrow_angle(double x1, double y1, double x2, double y2,
|
||||
r=sqrt(dx*dx+dy*dy);
|
||||
h = (double) arrow->ht;
|
||||
/* lines are made a little thinner in set_linewidth */
|
||||
- thick = (arrow->thickness <= THICK_SCALE) ?
|
||||
- 0.5* arrow->thickness :
|
||||
- arrow->thickness - THICK_SCALE;
|
||||
+ thick = arrow->thickness <= THICK_SCALE ?
|
||||
+ 0.5 * arrow->thickness : arrow->thickness - THICK_SCALE;
|
||||
/* lpt is the amount the arrowhead extends beyond the end of the line */
|
||||
lpt = thick/2.0/(arrow->wid/h/2.0);
|
||||
/* add this to the length */
|
||||
@@ -1107,6 +1106,8 @@ compute_arcarrow_angle(double x1, double y1, double x2, double y2,
|
||||
if (h > 2.0*r) {
|
||||
arc_tangent_int(x1,y1,x2,y2,direction,x,y);
|
||||
return;
|
||||
+ } else if (h < thick) {
|
||||
+ h = thick;
|
||||
}
|
||||
|
||||
beta=atan2(dy,dx);
|
||||
diff --git fig2dev/tests/output.at fig2dev/tests/output.at
|
||||
index fd06727..e0d088c 100644
|
||||
--- fig2dev/tests/output.at
|
||||
+++ fig2dev/tests/output.at
|
||||
@@ -2,7 +2,7 @@ dnl Fig2dev: Translate Fig code to various Devices
|
||||
dnl Copyright (c) 1991 by Micah Beck
|
||||
dnl Parts Copyright (c) 1985-1988 by Supoj Sutanthavibul
|
||||
dnl Parts Copyright (c) 1989-2015 by Brian V. Smith
|
||||
-dnl Parts Copyright (c) 2015-2019 by Thomas Loimer
|
||||
+dnl Parts Copyright (c) 2015-2020 by Thomas Loimer
|
||||
dnl
|
||||
dnl Any party obtaining a copy of these files is granted, free of charge, a
|
||||
dnl full and unrestricted irrevocable, world-wide, paid up, royalty-free,
|
||||
@@ -175,6 +175,14 @@ AT_CHECK([fig2dev -L pict2e -P big1.fig big1.tex && \
|
||||
], 0, ignore)
|
||||
AT_CLEANUP
|
||||
|
||||
+AT_SETUP([accept arc arrows with zero height, ticket #74])
|
||||
+AT_KEYWORDS(pict2e)
|
||||
+AT_CHECK([fig2dev -L pict2e <<EOF
|
||||
+FIG_FILE_TOP
|
||||
+5 1 0 1 0 7 50 -1 -1 0.0 0 0 1 0 0.0 0.0 600 0 0 600 -600 0
|
||||
+ 1 1 1.0 60.0 0.0
|
||||
+EOF], 0, ignore)
|
||||
+AT_CLEANUP
|
||||
|
||||
AT_BANNER([Test svg output language.])
|
||||
AT_SETUP([compare patterns with template])
|
||||
--
|
||||
2.16.4
|
||||
|
68
421afa.patch
68
421afa.patch
@ -1,68 +0,0 @@
|
||||
From 421afa17d8cb8dafcaf3e6044a70790fa4fe307b Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Mon, 27 Jan 2020 23:01:11 +0100
|
||||
Subject: [PATCH] Accept -1 TeX font in more places, fixes #71, #75
|
||||
|
||||
Continue the work started in commit [00cded]. Fix the fundamental issue of
|
||||
tickets #71 and #75, which was hidden by commit [d70e4b].
|
||||
---
|
||||
fig2dev/dev/texfonts.h | 14 +++++++++-----
|
||||
fig2dev/tests/read.at | 4 +++-
|
||||
2 files changed, 12 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git fig2dev/dev/texfonts.h fig2dev/dev/texfonts.h
|
||||
index 89097f2..e5254b6 100644
|
||||
--- fig2dev/dev/texfonts.h
|
||||
+++ fig2dev/dev/texfonts.h
|
||||
@@ -35,17 +35,21 @@ extern char texfontsizes[];
|
||||
#define MAXFONTSIZE 42
|
||||
|
||||
#ifdef NFSS
|
||||
-#define TEXFAMILY(F) (texfontfamily[((F) <= MAX_FONT) ? (F) : (MAX_FONT-1)])
|
||||
-#define TEXSERIES(F) (texfontseries[((F) <= MAX_FONT) ? (F) : (MAX_FONT-1)])
|
||||
-#define TEXSHAPE(F) (texfontshape[((F) <= MAX_FONT) ? (F) : (MAX_FONT-1)])
|
||||
+#define TEXFAMILY(F) texfontfamily[(F) <= MAX_FONT ? ((F) >= 0 ? (F) : 0) \
|
||||
+ : MAX_FONT-1]
|
||||
+#define TEXSERIES(F) texfontseries[(F) <= MAX_FONT ? ((F) >= 0 ? (F) : 0) \
|
||||
+ : MAX_FONT-1]
|
||||
+#define TEXSHAPE(F) texfontshape[(F) <= MAX_FONT ? ((F) >= 0 ? (F) : 0) \
|
||||
+ : MAX_FONT-1]
|
||||
#endif
|
||||
-#define TEXFONT(F) (texfontnames[((F) <= MAX_FONT) ? (F) : (MAX_FONT-1)])
|
||||
+#define TEXFONT(F) texfontnames[(F) <= MAX_FONT ? ((F) >= 0 ? (F) : 0) \
|
||||
+ : MAX_FONT-1]
|
||||
|
||||
/*
|
||||
#define TEXFONTSIZE(S) (texfontsizes[((S) <= MAXFONTSIZE) ? (int)(round(S))\
|
||||
: (MAXFONTSIZE-1)])
|
||||
*/
|
||||
-#define TEXFONTSIZE(S) (((S) <= MAXFONTSIZE) ? texfontsizes[(int)(round(S))] : (S))
|
||||
+#define TEXFONTSIZE(S) ((S) <= MAXFONTSIZE ? texfontsizes[(int)round(S)] : (S))
|
||||
#define TEXFONTMAG(T) TEXFONTSIZE(T->size*(rigid_text(T) ? 1.0 : fontmag))
|
||||
|
||||
void setfigfont(F_text *text); /* genepic.c */
|
||||
|diff --git fig2dev/tests/read.at fig2dev/tests/read.at
|
||||
|index 60982b0..726e6da 100644
|
||||
|--- fig2dev/tests/read.at
|
||||
|+++ fig2dev/tests/read.at
|
||||
|@@ -406,7 +406,7 @@ EOF
|
||||
| ])
|
||||
| AT_CLEANUP
|
||||
|
|
||||
|-AT_SETUP([allow tex font -1, ticket #81])
|
||||
|+AT_SETUP([allow tex font -1, tickets #71, #75, #81])
|
||||
| AT_KEYWORDS([pict2e tikz])
|
||||
| AT_DATA([text.fig], [FIG_FILE_TOP
|
||||
| 4 0 0 50 -1 -1 12 0.0 0 150 405 0 0 Text\001
|
||||
|@@ -415,6 +415,8 @@ AT_CHECK([fig2dev -L pict2e text.fig
|
||||
| ], 0, ignore)
|
||||
| AT_CHECK([fig2dev -L tikz text.fig
|
||||
| ], 0, ignore)
|
||||
|+AT_CHECK([fig2dev -L mp text.fig
|
||||
|+], 0, ignore)
|
||||
| AT_CLEANUP
|
||||
|
|
||||
| AT_SETUP([reject ASCII NUL ('\0') in input, ticket #80])
|
||||
--
|
||||
2.16.4
|
||||
|
114
4d4e1f.patch
114
4d4e1f.patch
@ -1,114 +0,0 @@
|
||||
From 4d4e1fdac467c386cba8706aa0067d5ab8da02d7 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Mon, 3 Feb 2020 23:39:32 +0100
|
||||
Subject: [PATCH] Allow DEFAULT color in cgm and ge output, #72, #73
|
||||
|
||||
Also, fix a memory leak in gencgm.c.
|
||||
---
|
||||
fig2dev/dev/gencgm.c | 8 +++++++-
|
||||
fig2dev/dev/genge.c | 7 ++++---
|
||||
fig2dev/tests/data/line.fig | 2 +-
|
||||
fig2dev/tests/output.at | 12 ++++++++++++
|
||||
4 files changed, 24 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git fig2dev/dev/gencgm.c fig2dev/dev/gencgm.c
|
||||
index 0f472a8..e12940f 100644
|
||||
--- fig2dev/dev/gencgm.c
|
||||
+++ fig2dev/dev/gencgm.c
|
||||
@@ -151,9 +151,11 @@ gencgm_start(F_compound *objects)
|
||||
{
|
||||
int i;
|
||||
char *p, *figname;
|
||||
+ char *figname_buf = NULL;
|
||||
|
||||
if (from) {
|
||||
- figname = strdup(from);
|
||||
+ figname_buf = strdup(from);
|
||||
+ figname = figname_buf;
|
||||
p = strrchr(figname, '/');
|
||||
if (p)
|
||||
figname = p+1; /* remove path from name for comment in file */
|
||||
@@ -255,6 +257,8 @@ gencgm_start(F_compound *objects)
|
||||
print_comments("% ",objects->comments, " %");
|
||||
fprintf(tfp,"%% %%\n");
|
||||
}
|
||||
+ if (figname_buf)
|
||||
+ free(figname_buf);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -552,6 +556,8 @@ hatchindex(index)
|
||||
static void
|
||||
getrgb(int color, int *r, int *g, int *b)
|
||||
{
|
||||
+ if (color < 0) /* DEFAULT color is black */
|
||||
+ color = 0;
|
||||
if (color < NUM_STD_COLS) {
|
||||
*r = stdcols[color].r * 255.;
|
||||
*g = stdcols[color].g * 255.;
|
||||
diff --git fig2dev/dev/genge.c fig2dev/dev/genge.c
|
||||
index b171f39..5697bb6 100644
|
||||
--- fig2dev/dev/genge.c
|
||||
+++ fig2dev/dev/genge.c
|
||||
@@ -56,7 +56,8 @@ static void genge_ctl_spline(F_spline *s);
|
||||
/* color mapping */
|
||||
/* xfig ge */
|
||||
|
||||
-static int GE_COLORS[] = { 1, /* black black */
|
||||
+static int GE_COLORS[] = { 1, /* DEFAULT == black */
|
||||
+ 1, /* black black */
|
||||
8, /* blue blue */
|
||||
7, /* green green */
|
||||
6, /* cyan cyan */
|
||||
@@ -438,7 +439,7 @@ back_arrow(F_line *l)
|
||||
static void
|
||||
set_color(int col)
|
||||
{
|
||||
- fprintf(tfp,"c%02d ",GE_COLORS[col]);
|
||||
+ fprintf(tfp,"c%02d ",GE_COLORS[col + 1]);
|
||||
}
|
||||
|
||||
/* set fill if there is a fill style */
|
||||
@@ -447,7 +448,7 @@ static void
|
||||
set_fill(int style, int color)
|
||||
{
|
||||
if (style != UNFILLED)
|
||||
- fprintf(tfp,"C%02d ",GE_COLORS[color]);
|
||||
+ fprintf(tfp,"C%02d ",GE_COLORS[color + 1]);
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git fig2dev/tests/data/line.fig fig2dev/tests/data/line.fig
|
||||
index e033b12..bfc4976 100644
|
||||
--- fig2dev/tests/data/line.fig
|
||||
+++ fig2dev/tests/data/line.fig
|
||||
@@ -7,5 +7,5 @@ A9
|
||||
Single
|
||||
-2
|
||||
1200 2
|
||||
-2 1 0 3 0 7 50 -1 -1 0.0 0 0 -1 0 0 3
|
||||
+2 1 0 3 -1 7 50 -1 -1 0.0 0 0 -1 0 0 3
|
||||
50 50 500 50 500 200
|
||||
diff --git fig2dev/tests/output.at fig2dev/tests/output.at
|
||||
index 9a1bc45..fd06727 100644
|
||||
--- fig2dev/tests/output.at
|
||||
+++ fig2dev/tests/output.at
|
||||
@@ -261,3 +261,15 @@ AT_CHECK([fig2dev -L tikz -P big1.fig big1.tex && \
|
||||
latex -halt-on-error big1.tex && latex -halt-on-error big2.tex
|
||||
], 0, ignore)
|
||||
AT_CLEANUP
|
||||
+
|
||||
+
|
||||
+AT_BANNER([Test other output languages.])
|
||||
+
|
||||
+AT_SETUP([allow default color in ge, cgm output, #72, #73])
|
||||
+AT_KEYWORDS(cgm ge)
|
||||
+AT_CHECK([fig2dev -L cgm $srcdir/data/line.fig
|
||||
+], 0, ignore)
|
||||
+AT_CHECK([fig2dev -L ge $srcdir/data/line.fig
|
||||
+], 0, ignore)
|
||||
+AT_CLEANUP
|
||||
+
|
||||
--
|
||||
2.16.4
|
||||
|
38
639c36.patch
38
639c36.patch
@ -1,38 +0,0 @@
|
||||
From 639c36010a120e97a6e82e7cd57cbf9dbf4b64f1 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Tue, 4 Feb 2020 21:52:25 +0100
|
||||
Subject: [PATCH] Fix pstricks fill with non-solid default color, #77
|
||||
|
||||
In the pstricks output, filling an area with the shaded or tinted default color
|
||||
is now equivalent to filling with shaded or tinted black color.
|
||||
---
|
||||
fig2dev/dev/genpstricks.c | 3 ++-
|
||||
fig2dev/tests/output.at | 1 -
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git fig2dev/dev/genpstricks.c fig2dev/dev/genpstricks.c
|
||||
index 07c4d09..5acc1f6 100644
|
||||
--- fig2dev/dev/genpstricks.c
|
||||
+++ fig2dev/dev/genpstricks.c
|
||||
@@ -1856,7 +1856,8 @@ format_options(char *options, char *prefix, char *postfix, char *sqrb_init,
|
||||
else if (fill_style <= 40)
|
||||
/* shade or tint fill */
|
||||
sprintf(tmps, "fillstyle=solid,fillcolor=%s",
|
||||
- shade_or_tint_name_after_declare_color(tmpc, fill_style, fill_color));
|
||||
+ shade_or_tint_name_after_declare_color(tmpc, fill_style,
|
||||
+ fill_color == DEFAULT ? CT_BLACK : fill_color));
|
||||
else {
|
||||
char *type = 0, *ps;
|
||||
int angle = 0;
|
||||
diff --git fig2dev/tests/output.at fig2dev/tests/output.at
|
||||
index e0d088c..e1e5ca4 100644
|
||||
--- fig2dev/tests/output.at
|
||||
+++ fig2dev/tests/output.at
|
||||
@@ -280,4 +280,3 @@ AT_CHECK([fig2dev -L cgm $srcdir/data/line.fig
|
||||
AT_CHECK([fig2dev -L ge $srcdir/data/line.fig
|
||||
], 0, ignore)
|
||||
AT_CLEANUP
|
||||
-
|
||||
--
|
||||
2.16.4
|
||||
|
@ -1,50 +0,0 @@
|
||||
Based on 19db5fe6f77ebad91af4b4ef0defd61bd0bb358f Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Wed, 4 Dec 2019 17:56:04 +0100
|
||||
Subject: [PATCH] Allow fig 2 text ending with multiple ^A, ticket #55
|
||||
|
||||
---
|
||||
fig2dev/read.c | 4 ++--
|
||||
fig2dev/tests/read.at | 11 +++++++++++
|
||||
2 files changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
--- fig2dev/read.c
|
||||
+++ fig2dev/read.c 2019-12-05 08:48:27.630190316 +0000
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (c) 1991 by Micah Beck
|
||||
* Parts Copyright (c) 1985-1988 by Supoj Sutanthavibul
|
||||
* Parts Copyright (c) 1989-2015 by Brian V. Smith
|
||||
- * Parts Copyright (c) 2015-2018 by Thomas Loimer
|
||||
+ * Parts Copyright (c) 2015-2019 by Thomas Loimer
|
||||
*
|
||||
* Any party obtaining a copy of these files is granted, free of charge, a
|
||||
* full and unrestricted irrevocable, world-wide, paid up, royalty-free,
|
||||
@@ -1328,7 +1328,7 @@ read_textobject(FILE *fp)
|
||||
If we do not find the CONTROL-A on this line then this must
|
||||
be a multi-line text object and we will have to read more. */
|
||||
|
||||
- n = sscanf(buf,"%*d%d%d%lf%d%d%d%lf%d%lf%lf%d%d%[^\1]%[\1]",
|
||||
+ n = sscanf(buf,"%*d%d%d%lf%d%d%d%lf%d%lf%lf%d%d%[^\1]%1[\1]",
|
||||
&t->type, &t->font, &t->size, &t->pen,
|
||||
&t->color, &t->depth, &t->angle,
|
||||
&t->flags, &t->height, &t->length,
|
||||
--- fig2dev/tests/read.at
|
||||
+++ fig2dev/tests/read.at 2019-12-05 08:48:27.634190239 +0000
|
||||
@@ -359,6 +359,17 @@ EOF
|
||||
], 0, ignore)
|
||||
AT_CLEANUP
|
||||
|
||||
+AT_SETUP([allow text ending with multiple ^A, ticket #55])
|
||||
+AT_KEYWORDS([read.c])
|
||||
+AT_CHECK([fig2dev -L box <<EOF
|
||||
+#FIG 2
|
||||
+1200 2
|
||||
+4 2 0 0 1 0 0 390 306 110 376 639 5 Text
|
||||
+EOF
|
||||
+], 1, ignore, [Invalid text object at line 2.
|
||||
+])
|
||||
+AT_CLEANUP
|
||||
+
|
||||
AT_BANNER([Dynamically allocate picture file name.])
|
||||
|
||||
AT_SETUP([prepend fig file path to picture file name])
|
@ -1,69 +0,0 @@
|
||||
Based on 3065abc7b4f740ed6532322843531317de782a26 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Tue, 10 Dec 2019 13:17:36 +0100
|
||||
Subject: [PATCH] Reject huge arrow types, ticket #57
|
||||
|
||||
An arrow type being large enough would pass the test for
|
||||
a valid type by integer overflow.
|
||||
---
|
||||
fig2dev/arrow.c | 13 ++++++++-----
|
||||
fig2dev/tests/read.at | 12 ++++++++++++
|
||||
2 files changed, 20 insertions(+), 5 deletions(-)
|
||||
|
||||
--- fig2dev/arrow.c
|
||||
+++ fig2dev/arrow.c 2020-01-21 11:02:33.457498151 +0000
|
||||
@@ -1,9 +1,10 @@
|
||||
/*
|
||||
* Fig2dev: Translate Fig code to various Devices
|
||||
- * Copyright (c) 1985 by Supoj Sutantavibul
|
||||
* Copyright (c) 1991 by Micah Beck
|
||||
- * Parts Copyright (c) 1989-2002 by Brian V. Smith
|
||||
- * Parts Copyright (c) 2015-2018 by Thomas Loimer
|
||||
+ * Parts Copyright (c) 1985-1988 by Supoj Sutanthavibul
|
||||
+ * Parts Copyright (c) 1989-2015 by Brian V. Smith
|
||||
+ * Parts Copyright (c) 2015-2019 by Thomas Loimer
|
||||
+ *
|
||||
*
|
||||
* Any party obtaining a copy of these files is granted, free of charge, a
|
||||
* full and unrestricted irrevocable, world-wide, paid up, royalty-free,
|
||||
@@ -78,7 +79,9 @@ make_arrow(int type, int style, double t
|
||||
{
|
||||
F_arrow *a;
|
||||
|
||||
- if (style < 0 || style > 1 || type < 0 || (type + 1) * 2 > NUMARROWS)
|
||||
+ if (style < 0 || style > 1 || type < 0 ||
|
||||
+ /* beware of int overflow */
|
||||
+ type > NUMARROWS || (type + 1) * 2 > NUMARROWS)
|
||||
return NULL;
|
||||
if (NULL == (Arrow_malloc(a))) {
|
||||
put_msg(Err_mem);
|
||||
@@ -90,7 +93,7 @@ make_arrow(int type, int style, double t
|
||||
|
||||
a->type = type;
|
||||
a->style = style;
|
||||
- a->thickness = thickness*THICK_SCALE;
|
||||
+ a->thickness = thickness * THICK_SCALE;
|
||||
a->wid = wid;
|
||||
a->ht = ht;
|
||||
return a;
|
||||
--- fig2dev/tests/read.at
|
||||
+++ fig2dev/tests/read.at 2020-01-21 11:02:33.457498151 +0000
|
||||
@@ -135,6 +135,18 @@ A single point with a backward arrow - r
|
||||
])
|
||||
AT_CLEANUP
|
||||
|
||||
+AT_SETUP([reject huge arrow-type, ticket #57])
|
||||
+AT_KEYWORDS(arrow.c arrow)
|
||||
+AT_CHECK([fig2dev -L box <<EOF
|
||||
+FIG_FILE_TOP
|
||||
+2 1 0 1 -1 -1 50 -1 -1 0. 0 0 0 1 0 2
|
||||
+ 10000000000000 0 1 60 120
|
||||
+0 0 600 0
|
||||
+EOF
|
||||
+], 1, ignore, [Invalid forward arrow at line 11.
|
||||
+])
|
||||
+AT_CLEANUP
|
||||
+
|
||||
AT_SETUP([reject negative font type])
|
||||
AT_KEYWORDS(read.c font)
|
||||
AT_CHECK([fig2dev -L box <<EOF
|
1867
CVE-2019-19797.patch
1867
CVE-2019-19797.patch
File diff suppressed because it is too large
Load Diff
84
acccc8.patch
84
acccc8.patch
@ -1,84 +0,0 @@
|
||||
From acccc89c20206a5db1f463438ba444e35bcb400e Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Tue, 28 Jan 2020 22:56:40 +0100
|
||||
Subject: [PATCH] Reject text or ellipse angles beyond -2pi to 2pi, #76
|
||||
|
||||
In fact, generously extend the allowed range to -7 to 7.
|
||||
Sane applications, e.g., xfig, certainly keep the angles within one revolution.
|
||||
---
|
||||
CHANGES | 6 +++---
|
||||
fig2dev/object.h | 7 ++++---
|
||||
fig2dev/tests/read.at | 8 ++++++++
|
||||
3 files changed, 15 insertions(+), 6 deletions(-)
|
||||
|
||||
|diff --git CHANGES CHANGES
|
||||
|index 4834e50..52daead 100644
|
||||
|--- CHANGES
|
||||
|+++ CHANGES
|
||||
|@@ -6,9 +6,9 @@ Patchlevel Xx (Xxx 20xx)
|
||||
|
|
||||
| BUGS FIXED:
|
||||
| Ticket numbers refer to https://sourceforge.net/p/mcj/tickets/#.
|
||||
|- o Fix ticket #81.
|
||||
|- o Do not allow ASCII NUL anywhere in input.
|
||||
|- Fixes tickets #65, #68, #71, #73, #75, #80.
|
||||
|+ o Accept text and ellipse angles only within -2*pi to 2*pi. Fixes #76.
|
||||
|+ o Allow -1 as default TeX font, not only 0. Fixes #71, #75, #81.
|
||||
|+ o Do not allow ASCII NUL anywhere in input. Fixes #65, #68, #73, #80.
|
||||
| o Use getline() to improve input scanning.
|
||||
| Fixes tickets #58, #59, #61, #62, #67, #78, #79.
|
||||
| o Correctly scan embedded pdfs for /MediaBox value.
|
||||
diff --git fig2dev/object.h fig2dev/object.h
|
||||
index fe56bbb..8464010 100644
|
||||
--- fig2dev/object.h
|
||||
+++ fig2dev/object.h
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (c) 1991 by Micah Beck
|
||||
* Parts Copyright (c) 1985-1988 by Supoj Sutanthavibul
|
||||
* Parts Copyright (c) 1989-2015 by Brian V. Smith
|
||||
- * Parts Copyright (c) 2015-2019 by Thomas Loimer
|
||||
+ * Parts Copyright (c) 2015-2020 by Thomas Loimer
|
||||
*
|
||||
* Any party obtaining a copy of these files is granted, free of charge, a
|
||||
* full and unrestricted irrevocable, world-wide, paid up, royalty-free,
|
||||
@@ -94,7 +94,8 @@ typedef struct f_ellipse {
|
||||
#define INVALID_ELLIPSE(e) \
|
||||
e->type < T_ELLIPSE_BY_RAD || e->type > T_CIRCLE_BY_DIA || \
|
||||
COMMON_PROPERTIES(e) || (e->direction != 1 && e->direction != 0) || \
|
||||
- e->radiuses.x == 0 || e->radiuses.y == 0
|
||||
+ e->radiuses.x == 0 || e->radiuses.y == 0 || \
|
||||
+ e->angle < -7. || e->angle > 7.
|
||||
|
||||
typedef struct f_arc {
|
||||
int type;
|
||||
@@ -243,7 +244,7 @@ typedef struct f_text {
|
||||
t->type < T_LEFT_JUSTIFIED || t->type > T_RIGHT_JUSTIFIED || \
|
||||
t->font < DEFAULT || t->font > MAX_PSFONT || \
|
||||
t->flags < DEFAULT || t->flags >= 2 * HIDDEN_TEXT || \
|
||||
- t->height < 0 || t->length < 0
|
||||
+ t->height < 0 || t->length < 0 || t->angle < -7. || t->angle > 7.
|
||||
|
||||
typedef struct f_control {
|
||||
double lx, ly, rx, ry; /* used by older versions*/
|
||||
|diff --git fig2dev/tests/read.at fig2dev/tests/read.at
|
||||
|index 726e6da..2d066e4 100644
|
||||
|--- fig2dev/tests/read.at
|
||||
|+++ fig2dev/tests/read.at
|
||||
|@@ -424,6 +424,14 @@ AT_KEYWORDS([read.c svg])
|
||||
| AT_CHECK([fig2dev -L svg $srcdir/data/text_w_ascii0.fig], 1, ignore, ignore)
|
||||
| AT_CLEANUP
|
||||
|
|
||||
|+AT_SETUP([reject out of range text angle, ticket #76])
|
||||
|+AT_CHECK([fig2dev -L pstricks <<EOF
|
||||
|+FIG_FILE_TOP
|
||||
|+4 0 0 50 -1 -1 12 9e26 0 150 405 0 0 Very slanted text\001
|
||||
|+EOF
|
||||
|+], 1, ignore, ignore)
|
||||
|+AT_CLEANUP
|
||||
|+
|
||||
| AT_BANNER([Dynamically allocate picture file name.])
|
||||
|
|
||||
| AT_SETUP([prepend fig file path to picture file name])
|
||||
--
|
||||
2.16.4
|
||||
|
65
c379fe.patch
65
c379fe.patch
@ -1,65 +0,0 @@
|
||||
Based on c379fe50574e5b5dd6e17f15d8473c5713d1b823 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Wed, 11 Dec 2019 21:36:46 +0100
|
||||
Subject: [PATCH] Convert polygons with too few points to polylines
|
||||
|
||||
As a side effect, this also fixes ticket #56.
|
||||
---
|
||||
fig2dev/read.c | 16 ++++++++++++++++
|
||||
fig2dev/tests/read.at | 11 +++++++++++
|
||||
2 files changed, 27 insertions(+)
|
||||
|
||||
--- fig2dev/read.c
|
||||
+++ fig2dev/read.c 2020-01-21 11:29:27.367140319 +0000
|
||||
@@ -793,8 +793,10 @@ read_ellipseobject(void)
|
||||
/*
|
||||
* Sanitize line objects. Return 0 on success, -1 otherwise.
|
||||
* On error, call free_linestorage(l) after sanitize_lineobject().
|
||||
+ *
|
||||
* polylines: remove fill, if less than 3 points
|
||||
* remove arrows, if only one point
|
||||
+ * polygons: convert to polyline if less than 3 unique points
|
||||
* rectangles, polygons: last point must coincide with first point
|
||||
* rectangle: convert to polygon, if not 5 points
|
||||
* rectangle with rounded corners: error, if not 5 points
|
||||
@@ -854,6 +856,20 @@ sanitize_lineobject(
|
||||
q->y = l->points->y;
|
||||
}
|
||||
|
||||
+ if (l->type == T_POLYGON) {
|
||||
+ int npts;
|
||||
+
|
||||
+ q = l->points;
|
||||
+ for (npts = 1; q->next && npts < 4; q = q->next)
|
||||
+ ++npts;
|
||||
+ if (npts < 4 ) {
|
||||
+ put_msg("A polygon with %d points at line %d - convert to a polyline.",
|
||||
+ npts, line_no);
|
||||
+ l->type = T_POLYLINE;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (l->type == T_BOX || l->type == T_ARC_BOX || l->type == T_PIC_BOX) {
|
||||
int npts = 1;
|
||||
for (q = l->points; q->next; q = q->next)
|
||||
--- fig2dev/tests/read.at
|
||||
+++ fig2dev/tests/read.at 2020-01-21 11:29:27.367140319 +0000
|
||||
@@ -147,6 +147,17 @@ EOF
|
||||
])
|
||||
AT_CLEANUP
|
||||
|
||||
+AT_SETUP([convert short polygon to polyline, ticket #56])
|
||||
+AT_KEYWORDS(read.c polygon)
|
||||
+AT_CHECK([fig2dev -L ptk <<EOF
|
||||
+FIG_FILE_TOP
|
||||
+2 3 0 1 -1 -1 50 -1 -1 0.0 0 0 -1 0 0 1
|
||||
+ 0 0
|
||||
+EOF
|
||||
+], 0, ignore, [A polygon with 1 points at line 11 - convert to a polyline.
|
||||
+])
|
||||
+AT_CLEANUP
|
||||
+
|
||||
AT_SETUP([reject negative font type])
|
||||
AT_KEYWORDS(read.c font)
|
||||
AT_CHECK([fig2dev -L box <<EOF
|
35
ca48cc.patch
35
ca48cc.patch
@ -1,35 +0,0 @@
|
||||
From ca48ccc90bd3e7801a63cf9a541f292b28ed1260 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Mon, 17 Feb 2020 12:18:12 +0100
|
||||
Subject: [PATCH] Amend previous commit - avoid buffer overflow
|
||||
|
||||
Regards to Dr. Werner Fink, see discussion to ticket #83.
|
||||
---
|
||||
fig2dev/read.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git fig2dev/read.c fig2dev/read.c
|
||||
index 0bdcd3d..d1ae463 100644
|
||||
--- fig2dev/read.c
|
||||
+++ fig2dev/read.c
|
||||
@@ -1489,8 +1489,6 @@ read_textobject(FILE *fp, char **restrict line, size_t *line_len, int *line_no)
|
||||
|
||||
len = strlen(start);
|
||||
start[len++] = '\n'; /* put back the newline */
|
||||
- start[len] = '\0'; /* and terminate the string,
|
||||
- in case nothing else is found */
|
||||
|
||||
/* allocate plenty of space */
|
||||
next = malloc(len + BUFSIZ);
|
||||
@@ -1500,6 +1498,8 @@ read_textobject(FILE *fp, char **restrict line, size_t *line_len, int *line_no)
|
||||
return NULL;
|
||||
}
|
||||
memcpy(next, start, len + 1);
|
||||
+ next[len] = '\0'; /* terminate the initial string,
|
||||
+ in case nothing else is found */
|
||||
|
||||
while ((chars = getline(line, line_len, fp)) != -1) {
|
||||
++(*line_no);
|
||||
--
|
||||
2.16.4
|
||||
|
40
d6a10d.patch
40
d6a10d.patch
@ -1,40 +0,0 @@
|
||||
From d6a10d168469ed9c4d681ebdc577ea0f65de1501 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Sun, 26 Jan 2020 22:13:26 +0100
|
||||
Subject: [PATCH] Fix ticket #60. The previous commit fixed also #65, #68, #71,
|
||||
#73, #75
|
||||
|
||||
---
|
||||
CHANGES | 3 ++-
|
||||
fig2dev/read.c | 1 +
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
|diff --git CHANGES CHANGES
|
||||
|index f1bbbc3..4834e50 100644
|
||||
|--- CHANGES
|
||||
|+++ CHANGES
|
||||
|@@ -7,7 +7,8 @@ Patchlevel Xx (Xxx 20xx)
|
||||
| BUGS FIXED:
|
||||
| Ticket numbers refer to https://sourceforge.net/p/mcj/tickets/#.
|
||||
| o Fix ticket #81.
|
||||
|- o Do not allow ASCII NUL anywhere in input. Fixes ticket #80.
|
||||
|+ o Do not allow ASCII NUL anywhere in input.
|
||||
|+ Fixes tickets #65, #68, #71, #73, #75, #80.
|
||||
| o Use getline() to improve input scanning.
|
||||
| Fixes tickets #58, #59, #61, #62, #67, #78, #79.
|
||||
| o Correctly scan embedded pdfs for /MediaBox value.
|
||||
diff --git fig2dev/read.c fig2dev/read.c
|
||||
index 86cee71..797030c 100644
|
||||
--- fig2dev/read.c
|
||||
+++ fig2dev/read.c
|
||||
@@ -1322,6 +1322,7 @@ read_splineobject(FILE *fp, char **restrict line, size_t *line_len,
|
||||
}
|
||||
q->x = x;
|
||||
q->y = y;
|
||||
+ q->next = NULL;
|
||||
p->next = q;
|
||||
p = q;
|
||||
++c;
|
||||
--
|
||||
2.16.4
|
||||
|
129
d70e4b.patch
129
d70e4b.patch
@ -1,129 +0,0 @@
|
||||
From d70e4ba6308046f71cb51f67db8412155af52411 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Sun, 26 Jan 2020 13:16:52 +0100
|
||||
Subject: [PATCH] Reject ASCII NUL anywhere in the input
|
||||
|
||||
The input is read in line by line, stored in a buffer and processed further
|
||||
with sscanf(). Embedded NUL characters ('\0') would already disturb sscanf(),
|
||||
and nowhere does the code expect NUL characters. Therefore, detect NUL while
|
||||
reading the input, and exit with an error message when NUL is found anywere.
|
||||
Fixes ticket #80.
|
||||
---
|
||||
CHANGES | 4 ++++
|
||||
fig2dev/read.c | 21 +++++++++++++++++++--
|
||||
fig2dev/tests/data/text_w_ascii0.fig | Bin 0 -> 321 bytes
|
||||
fig2dev/tests/read.at | 6 ++++++
|
||||
4 files changed, 29 insertions(+), 2 deletions(-)
|
||||
create mode 100644 fig2dev/tests/data/text_w_ascii0.fig
|
||||
|
||||
|diff --git CHANGES CHANGES
|
||||
|index 4a414fa..f1bbbc3 100644
|
||||
|--- CHANGES
|
||||
|+++ CHANGES
|
||||
|@@ -6,6 +6,10 @@ Patchlevel Xx (Xxx 20xx)
|
||||
|
|
||||
| BUGS FIXED:
|
||||
| Ticket numbers refer to https://sourceforge.net/p/mcj/tickets/#.
|
||||
|+ o Fix ticket #81.
|
||||
|+ o Do not allow ASCII NUL anywhere in input. Fixes ticket #80.
|
||||
|+ o Use getline() to improve input scanning.
|
||||
|+ Fixes tickets #58, #59, #61, #62, #67, #78, #79.
|
||||
| o Correctly scan embedded pdfs for /MediaBox value.
|
||||
| o Convert polygons having too few points to polylines. Ticket #56.
|
||||
| o Reject huge arrow types causing integer overflow. Ticket #57.
|
||||
diff --git fig2dev/read.c fig2dev/read.c
|
||||
index e85ee10..86cee71 100644
|
||||
--- fig2dev/read.c
|
||||
+++ fig2dev/read.c
|
||||
@@ -178,8 +178,14 @@ read_objects(FILE *fp, F_compound *obj)
|
||||
put_msg("Could not read input file.");
|
||||
return -1;
|
||||
}
|
||||
- /* seek to the end of the first line */
|
||||
- if (strchr(buf, '\n') == NULL) {
|
||||
+
|
||||
+ /* check for embedded '\0' */
|
||||
+ if (strlen(buf) < sizeof buf - 1 && buf[strlen(buf) - 1] != '\n') {
|
||||
+ put_msg("ASCII NUL ('\\0') character within the first line.");
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ /* seek to the end of the first line
|
||||
+ (the only place, where '\0's are tolerated) */
|
||||
+ } else if (buf[strlen(buf) - 1] != '\n') {
|
||||
int c;
|
||||
do
|
||||
c = fgetc(fp);
|
||||
@@ -1398,6 +1404,15 @@ read_splineobject(FILE *fp, char **restrict line, size_t *line_len,
|
||||
return s;
|
||||
}
|
||||
|
||||
+static void
|
||||
+exit_on_ascii_NUL(const char *restrict line, size_t chars, int line_no)
|
||||
+{
|
||||
+ if (strlen(line) < (size_t)chars) {
|
||||
+ put_msg("ASCII NUL ('\\0') in line %d.", line_no);
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static char *
|
||||
find_end(const char *str, int v30flag)
|
||||
{
|
||||
@@ -1469,6 +1484,7 @@ read_textobject(FILE *fp, char **restrict line, size_t *line_len, int *line_no)
|
||||
|
||||
while ((chars = getline(line, line_len, fp)) != -1) {
|
||||
++(*line_no);
|
||||
+ exit_on_ascii_NUL(*line, chars, *line_no);
|
||||
end = find_end(*line, v30_flag);
|
||||
if (end) {
|
||||
*end = '\0';
|
||||
@@ -1640,6 +1656,7 @@ get_line(FILE *fp, char **restrict line, size_t *line_len, int *line_no)
|
||||
if (**line == '\n' || (**line == '\r' &&
|
||||
chars == 2 && (*line)[1] == '\n'))
|
||||
continue;
|
||||
+ exit_on_ascii_NUL(*line, chars, *line_no);
|
||||
/* remove newline and possibly a carriage return */
|
||||
if ((*line)[chars-1] == '\n') {
|
||||
chars -= (*line)[chars - 2] == '\r' ? 2 : 1;
|
||||
|diff --git fig2dev/tests/data/text_w_ascii0.fig fig2dev/tests/data/text_w_ascii0.fig
|
||||
|new file mode 100644
|
||||
|index 0000000000000000000000000000000000000000..fb15b306b26a42446b809d0caf77efcfc73c588a
|
||||
|GIT binary patch
|
||||
|literal 321
|
||||
|zcmV-H0lxktMoC8?GcGa;Okr+hb7Ns}WeP)OZggdG3Q2BbXk~K>Ol5R*WpWBJFfcAK
|
||||
|zFbY#?Zf9&|3N11UF)}bPATkOxATS^>ATl5@ATl)|F*Y+GGch1HATS^xFd!{4ATb~?
|
||||
|zATkOdFeV^0ATcs9AT=O)Tp%DYATS^>US3{aUP@kGUS3`R!hplS!@pi$US3{aUS3{a
|
||||
|zUS3{aUS3{aUS3{aG&LYaTrf#7d0a3sF$yCzATS^>AT=-`EioW1F(5HAATTa4ATS^?
|
||||
|zH83DFFf|}BATS_7ZXjWEV`*t1dS!BNASYa0Fee~rWpZU8Ej|D)E-qniWFT{IZDk;B
|
||||
|zZ*pZIbY*ySAZBlDY;SjIZf7hYcWHEJAYmY5WpZ?3X>K54ZEtmMbRchLAZ=-GX>E0F
|
||||
|TAY*7@a$#e1WpZ;|FfcI+7J*tc
|
||||
|
|
||||
|literal 0
|
||||
|KcmV+b0RR6000031
|
||||
|
|
||||
|diff --git fig2dev/tests/read.at fig2dev/tests/read.at
|
||||
|index 331afb5..60982b0 100644
|
||||
|--- fig2dev/tests/read.at
|
||||
|+++ fig2dev/tests/read.at
|
||||
|@@ -407,6 +407,7 @@ EOF
|
||||
| AT_CLEANUP
|
||||
|
|
||||
| AT_SETUP([allow tex font -1, ticket #81])
|
||||
|+AT_KEYWORDS([pict2e tikz])
|
||||
| AT_DATA([text.fig], [FIG_FILE_TOP
|
||||
| 4 0 0 50 -1 -1 12 0.0 0 150 405 0 0 Text\001
|
||||
| ])
|
||||
|@@ -416,6 +417,11 @@ AT_CHECK([fig2dev -L tikz text.fig
|
||||
| ], 0, ignore)
|
||||
| AT_CLEANUP
|
||||
|
|
||||
|+AT_SETUP([reject ASCII NUL ('\0') in input, ticket #80])
|
||||
|+AT_KEYWORDS([read.c svg])
|
||||
|+AT_CHECK([fig2dev -L svg $srcdir/data/text_w_ascii0.fig], 1, ignore, ignore)
|
||||
|+AT_CLEANUP
|
||||
|+
|
||||
| AT_BANNER([Dynamically allocate picture file name.])
|
||||
|
|
||||
| AT_SETUP([prepend fig file path to picture file name])
|
||||
--
|
||||
2.16.4
|
||||
|
33
e3cee2.patch
33
e3cee2.patch
@ -1,33 +0,0 @@
|
||||
From e3cee2576438f47a3b8678c6960472e625f8f7d7 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
|
||||
Date: Mon, 27 Jan 2020 22:14:29 +0100
|
||||
Subject: [PATCH] Keep coordinates of spline controls within sane range
|
||||
|
||||
This fixes the fundamental issue of ticket #65.
|
||||
---
|
||||
fig2dev/read.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git fig2dev/read.c fig2dev/read.c
|
||||
index 797030c..255586a 100644
|
||||
--- fig2dev/read.c
|
||||
+++ fig2dev/read.c
|
||||
@@ -1393,6 +1393,15 @@ read_splineobject(FILE *fp, char **restrict line, size_t *line_len,
|
||||
free_splinestorage(s);
|
||||
return NULL;
|
||||
}
|
||||
+ if (lx < INT_MIN || lx > INT_MAX || ly < INT_MIN || ly > INT_MAX ||
|
||||
+ rx < INT_MIN || rx > INT_MAX || ry < INT_MIN || ry > INT_MAX) {
|
||||
+ /* do not care to clean up, we exit anyway
|
||||
+ cp->next = NULL;
|
||||
+ free_splinestorage(s); */
|
||||
+ put_msg("Spline control points out of range at line %d.",
|
||||
+ *line_no);
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
cq->lx = lx; cq->ly = ly;
|
||||
cq->rx = rx; cq->ry = ry;
|
||||
cp->next = cq;
|
||||
--
|
||||
2.16.4
|
||||
|
@ -1,8 +1,3 @@
|
||||
Author: Michael Pfeiffer <p3fff@web.de>
|
||||
Description: creating multilayered or singlelayer PDF or EPS figures for
|
||||
including into LaTeX documents.
|
||||
Origin: http://p3f.gmxhome.de/fig2mpdf/fig2mpdf.html
|
||||
|
||||
---
|
||||
fig2dev/dev/genpstex.c | 331 ++++++++++++++++++++++++
|
||||
fig2dev/drivers.h | 4
|
||||
@ -13,22 +8,23 @@ Origin: http://p3f.gmxhome.de/fig2mpdf/fig2mpdf.html
|
||||
man/fig2dev.1.in | 69 +++++
|
||||
7 files changed, 1311 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/fig2dev-3.2.7b/fig2dev/dev/genpstex.c
|
||||
+++ b/fig2dev-3.2.7b/fig2dev/dev/genpstex.c
|
||||
@@ -48,9 +48,12 @@
|
||||
diff --git a/fig2dev/dev/genpstex.c b/fig2dev/dev/genpstex.c
|
||||
--- a/fig2dev/dev/genpstex.c
|
||||
+++ b/fig2dev/dev/genpstex.c
|
||||
@@ -47,9 +47,12 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <stdlib.h>
|
||||
|
||||
#include "fig2dev.h"
|
||||
#include "object.h" /* does #include <X11/xpm.h> */
|
||||
#include "object.h"
|
||||
+#include "texfonts.h"
|
||||
+#include "setfigfont.h"
|
||||
|
||||
extern double rad2deg;
|
||||
|
||||
@@ -79,6 +82,308 @@ extern void genps_grid(float major, floa
|
||||
@@ -78,6 +81,308 @@ extern void genps_grid(float major, floa
|
||||
|
||||
static char pstex_file[1000] = "";
|
||||
|
||||
@ -337,7 +333,7 @@ Origin: http://p3f.gmxhome.de/fig2mpdf/fig2mpdf.html
|
||||
void
|
||||
genpstex_t_option(char opt, char *optarg)
|
||||
{
|
||||
@@ -128,6 +433,32 @@ genpstex_option(char opt, char *optarg)
|
||||
@@ -127,6 +432,32 @@ genpstex_option(char opt, char *optarg)
|
||||
genlatex_option(opt, optarg);
|
||||
}
|
||||
|
||||
@ -370,8 +366,9 @@ Origin: http://p3f.gmxhome.de/fig2mpdf/fig2mpdf.html
|
||||
struct driver dev_pstex_t = {
|
||||
genpstex_t_option,
|
||||
genpstex_t_start,
|
||||
--- a/fig2dev-3.2.7b/fig2dev/drivers.h
|
||||
+++ b/fig2dev-3.2.7b/fig2dev/drivers.h
|
||||
diff --git a/fig2dev/drivers.h b/fig2dev/drivers.h
|
||||
--- a/fig2dev/drivers.h
|
||||
+++ b/fig2dev/drivers.h
|
||||
@@ -36,8 +36,10 @@ extern struct driver dev_eps;
|
||||
extern struct driver dev_pdf;
|
||||
extern struct driver dev_pdftex;
|
||||
@ -399,9 +396,10 @@ Origin: http://p3f.gmxhome.de/fig2mpdf/fig2mpdf.html
|
||||
{"pstricks", &dev_pstricks},
|
||||
{"ptk", &dev_ptk},
|
||||
{"shape", &dev_shape},
|
||||
--- a/fig2dev-3.2.7b/fig2dev/fig2dev.c
|
||||
+++ b/fig2dev-3.2.7b/fig2dev/fig2dev.c
|
||||
@@ -821,6 +821,23 @@ help_msg(void)
|
||||
diff --git a/fig2dev/fig2dev.c b/fig2dev/fig2dev.c
|
||||
--- a/fig2dev/fig2dev.c
|
||||
+++ b/fig2dev/fig2dev.c
|
||||
@@ -826,6 +826,23 @@ help_msg(void)
|
||||
);
|
||||
}
|
||||
|
||||
@ -425,7 +423,7 @@ Origin: http://p3f.gmxhome.de/fig2mpdf/fig2mpdf.html
|
||||
if (dev == NULL || !strcmp(lang, "shape")) {
|
||||
puts(
|
||||
"SHAPE (ShapePar driver) Options:\n"
|
||||
@@ -968,6 +985,12 @@ static int compound_dump(F_compound *com
|
||||
@@ -973,6 +990,12 @@ static int compound_dump(F_compound *com
|
||||
static int
|
||||
rec_comp(struct obj_rec *r1, struct obj_rec *r2)
|
||||
{
|
||||
@ -438,8 +436,9 @@ Origin: http://p3f.gmxhome.de/fig2mpdf/fig2mpdf.html
|
||||
return (r2->depth - r1->depth);
|
||||
}
|
||||
|
||||
--- a/fig2dev-3.2.7b/fig2mpdf/copyright.txt
|
||||
+++ b/fig2dev-3.2.7b/fig2mpdf/copyright.txt
|
||||
diff --git a/fig2mpdf/copyright.txt b/fig2mpdf/copyright.txt
|
||||
--- a/fig2mpdf/copyright.txt
|
||||
+++ b/fig2mpdf/copyright.txt
|
||||
@@ -0,0 +1,25 @@
|
||||
+The following files contain copyright and license info for
|
||||
+the code they contain:
|
||||
@ -466,8 +465,9 @@ Origin: http://p3f.gmxhome.de/fig2mpdf/fig2mpdf.html
|
||||
+
|
||||
+ (Author's note: the license is in the file gpl.txt, which is included
|
||||
+ in the archive.)
|
||||
--- a/fig2dev-3.2.7b/fig2mpdf/fig2mpdf.1
|
||||
+++ b/fig2dev-3.2.7b/fig2mpdf/fig2mpdf.1
|
||||
diff --git a/fig2mpdf/fig2mpdf.1 b/fig2mpdf/fig2mpdf.1
|
||||
--- a/fig2mpdf/fig2mpdf.1
|
||||
+++ b/fig2mpdf/fig2mpdf.1
|
||||
@@ -0,0 +1,208 @@
|
||||
+.TH fig2mpdf 1 "Jun 2006" "" "Including xfig figures into LaTeX documents"
|
||||
+.SH NAME
|
||||
@ -677,8 +677,9 @@ Origin: http://p3f.gmxhome.de/fig2mpdf/fig2mpdf.html
|
||||
+.IR pdflatex(1)
|
||||
+.IR latex(1)
|
||||
+.IR dvips(1)
|
||||
--- a/fig2dev-3.2.7b/fig2mpdf/fig2mpdf
|
||||
+++ b/fig2dev-3.2.7b/fig2mpdf/fig2mpdf
|
||||
diff --git a/fig2mpdf/fig2mpdf b/fig2mpdf/fig2mpdf
|
||||
--- a/fig2mpdf/fig2mpdf
|
||||
+++ b/fig2mpdf/fig2mpdf
|
||||
@@ -0,0 +1,653 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
@ -1333,8 +1334,9 @@ Origin: http://p3f.gmxhome.de/fig2mpdf/fig2mpdf.html
|
||||
+}
|
||||
+' -- $*
|
||||
+
|
||||
--- a/fig2dev-3.2.7b/man/fig2dev.1.in
|
||||
+++ b/fig2dev-3.2.7b/man/fig2dev.1.in
|
||||
diff --git a/man/fig2dev.1.in b/man/fig2dev.1.in
|
||||
--- a/man/fig2dev.1.in
|
||||
+++ b/man/fig2dev.1.in
|
||||
@@ -64,8 +64,8 @@ Set the output graphics language.
|
||||
Valid languages are
|
||||
\fBbox, cgm, dxf, epic, eepic, eepicemu, emf, eps, gbx (Gerber beta
|
||||
|
@ -9,7 +9,7 @@ Subject: rgb.txt can not be located via FIG2DEV_RGBFILE environment variable.
|
||||
|
||||
--- a/fig2dev/colors.c
|
||||
+++ b/fig2dev/colors.c 2019-10-29 11:03:32.206632962 +0000
|
||||
@@ -731,8 +731,13 @@ read_colordb(void)
|
||||
@@ -730,8 +730,13 @@ read_colordb(void)
|
||||
FILE *fp;
|
||||
#define MAX_LINE 100
|
||||
char s[MAX_LINE], s1[MAX_LINE];
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:47dc1b4420a1bc503b3771993e19cdaf75120d38be6548709f7d84f7b07d68b2
|
||||
size 512224
|
3
fig2dev-3.2.8.tar.xz
Normal file
3
fig2dev-3.2.8.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:931258ae43950d0931ddcea13ce6554d2cd7fc3c93585aebf74e393bb14fe27d
|
||||
size 518984
|
@ -1,171 +0,0 @@
|
||||
---
|
||||
fig2dev/dev/genps.c | 29 ++++++++++++++++++++++++-----
|
||||
fig2dev/dev/genpstex.c | 8 ++++++--
|
||||
fig2dev/fig2ps2tex.csh | 2 +-
|
||||
fig2dev/getopt.c | 9 +++++++++
|
||||
transfig/transfig.c | 2 ++
|
||||
5 files changed, 42 insertions(+), 8 deletions(-)
|
||||
|
||||
--- fig2dev/dev/genps.c
|
||||
+++ fig2dev/dev/genps.c 2018-05-07 08:16:40.161130640 +0000
|
||||
@@ -59,6 +59,7 @@
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
#include <locale.h>
|
||||
+#include <langinfo.h>
|
||||
#include "pi.h"
|
||||
|
||||
#include "fig2dev.h" /* includes "bool.h" */
|
||||
@@ -844,8 +845,9 @@ genps_start(F_compound *objects)
|
||||
fprintf(tfp, "%s\n", SPLINE_PS);
|
||||
#ifdef I18N
|
||||
if (support_i18n && iso_text_exist(objects)) {
|
||||
- char *libdir, *locale;
|
||||
+ char *libdir, *locale, *codeset;
|
||||
char localefile[512], str[512];
|
||||
+ size_t llen;
|
||||
FILE *fp;
|
||||
libdir = getenv("FIG2DEV_LIBDIR");
|
||||
#ifdef I18N_DATADIR
|
||||
@@ -853,18 +855,35 @@ genps_start(F_compound *objects)
|
||||
libdir = I18N_DATADIR;
|
||||
#endif
|
||||
locale = setlocale(LC_CTYPE, NULL);
|
||||
+ llen = strcspn(locale, ".@");
|
||||
+ codeset = nl_langinfo(CODESET);
|
||||
if (locale == NULL) {
|
||||
fprintf(stderr,
|
||||
"fig2dev: LANG not defined; assuming C locale\n");
|
||||
locale = "C";
|
||||
}
|
||||
- sprintf(localefile, "%s/%s.ps", libdir, locale);
|
||||
+ snprintf(localefile, sizeof(localefile)-1, "%s/%s.ps", libdir, locale);
|
||||
/* get filename like ``/usr/local/lib/fig2dev/japanese.ps'' */
|
||||
fp = fopen(localefile, "rb");
|
||||
if (fp == NULL) {
|
||||
- fprintf(stderr, "fig2dev: can not open file: %s\n",
|
||||
- localefile);
|
||||
- } else {
|
||||
+ fprintf(stderr, "fig2dev: can not open file: %s\n", localefile);
|
||||
+ }
|
||||
+ if (fp == NULL && strlen(locale) != llen) {
|
||||
+ locale[llen] = '\0';
|
||||
+ /* get filename like ``/usr/local/lib/fig2dev/de_DE.ps'' */
|
||||
+ snprintf(localefile, sizeof(localefile)-1, "%s/%s.ps", libdir, locale);
|
||||
+ fp = fopen(localefile, "rb");
|
||||
+ if (fp == NULL)
|
||||
+ fprintf(stderr, "fig2dev: B can't open file: %s\n", localefile);
|
||||
+ }
|
||||
+ if (fp == NULL && codeset) {
|
||||
+ /* get filename like ``/usr/local/lib/fig2dev/ISO-8859-9.ps'' */
|
||||
+ snprintf(localefile, sizeof(localefile)-1, "%s/%s.ps", libdir, codeset);
|
||||
+ fp = fopen(localefile, "rb");
|
||||
+ if (fp == NULL)
|
||||
+ fprintf(stderr, "fig2dev: C can't open file: %s\n", localefile);
|
||||
+ }
|
||||
+ if (fp) {
|
||||
while (fgets(str, sizeof(str), fp)) {
|
||||
if (strstr(str, "CompositeRoman"))
|
||||
enable_composite_font = true;
|
||||
--- fig2dev/dev/genpstex.c
|
||||
+++ fig2dev/dev/genpstex.c 2018-05-07 08:10:27.872048970 +0000
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
+#include <sys/stat.h>
|
||||
|
||||
#include "fig2dev.h"
|
||||
#include "object.h" /* does #include <X11/xpm.h> */
|
||||
@@ -63,10 +64,13 @@ extern void
|
||||
genps_spline(F_spline *s),
|
||||
genlatex_option(char opt, char *optarg),
|
||||
genlatex_text(F_text *t),
|
||||
- genps_text(F_text *t);
|
||||
+ genps_text(F_text *t),
|
||||
+ genpdf_option(char opt, char *optarg),
|
||||
+ genpdf_start(F_compound *objects);
|
||||
extern int
|
||||
genlatex_end(void),
|
||||
- genps_end(void);
|
||||
+ genps_end(void),
|
||||
+ genpdf_end(void);
|
||||
|
||||
extern void genpdf_option(char opt, char *optarg); /* genpdf.c */
|
||||
extern void genpdf_start(F_compound *objects); /* genpdf.c */
|
||||
--- fig2dev/fig2ps2tex.csh
|
||||
+++ fig2dev/fig2ps2tex.csh 2018-05-07 08:11:38.206742453 +0000
|
||||
@@ -22,7 +22,7 @@
|
||||
# 2016-07-07 Thomas Loimer
|
||||
# * use here-document, instead of echo
|
||||
#
|
||||
-
|
||||
+set echo_style = bsd
|
||||
set bbox = `grep "^%%BoundingBox:" $1`
|
||||
|
||||
set xsp = `echo "3k $bbox[4] $bbox[2] - 72 / p" | dc`
|
||||
--- fig2dev/getopt.c
|
||||
+++ fig2dev/getopt.c 2018-05-07 08:13:44.400397232 +0000
|
||||
@@ -48,6 +48,7 @@ static char sccsfid[] = "@(#) getopt.c 5
|
||||
#define EMSG ""
|
||||
#define ENDARGS "--"
|
||||
|
||||
+#ifndef __GLIBC__
|
||||
/*
|
||||
* get option letter from argument vector
|
||||
*/
|
||||
@@ -94,3 +95,11 @@ fig_getopt(int nargc, char **nargv, char
|
||||
}
|
||||
return optc; /* dump back option letter */
|
||||
}
|
||||
+#else
|
||||
+#include <unistd.h>
|
||||
+int
|
||||
+fig_getopt(int nargc, char * const nargv[], const char *ostr)
|
||||
+{
|
||||
+ return getopt(nargc, nargv, ostr);
|
||||
+}
|
||||
+#endif
|
||||
--- transfig/transfig.c
|
||||
+++ transfig/transfig.c 2018-05-07 08:01:42.105796359 +0000
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
#include "transfig.h"
|
||||
|
||||
extern void sysmv(char *file); /* sys.c */
|
||||
--- configure
|
||||
+++ configure 2020-01-24 13:08:02.103408590 +0000
|
||||
@@ -4122,7 +4122,7 @@ main ()
|
||||
|
||||
int dynamic_array[ni.number];
|
||||
dynamic_array[ni.number - 1] = 543;
|
||||
-
|
||||
+ free(ia);
|
||||
// work around unused variable warnings
|
||||
return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
|
||||
|| dynamic_array[ni.number - 1] != 543);
|
||||
@@ -6377,8 +6377,8 @@ char *malloc ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
-return ! malloc (0);
|
||||
- ;
|
||||
+void *tmp = malloc (0);
|
||||
+if (tmp) free (tmp); return !tmp;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
@@ -6444,7 +6444,8 @@ char *realloc ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
-return ! realloc (0, 0);
|
||||
+void *tmp = realloc (0, 0);
|
||||
+if (tmp) free (tmp); return !tmp;
|
||||
;
|
||||
return 0;
|
||||
}
|
163
transfig-3.2.8.dif
Normal file
163
transfig-3.2.8.dif
Normal file
@ -0,0 +1,163 @@
|
||||
---
|
||||
configure | 2 +-
|
||||
fig2dev/dev/genps.c | 32 ++++++++++++++++++++++----------
|
||||
fig2dev/dev/genpstex.c | 8 ++++++--
|
||||
fig2dev/fig2ps2tex.csh | 2 +-
|
||||
fig2dev/lib/getopt.c | 9 +++++++++
|
||||
transfig/transfig.c | 2 ++
|
||||
6 files changed, 41 insertions(+), 14 deletions(-)
|
||||
|
||||
--- configure
|
||||
+++ configure 2021-02-12 08:54:37.958704809 +0000
|
||||
@@ -4015,7 +4015,7 @@ main ()
|
||||
|
||||
int dynamic_array[ni.number];
|
||||
dynamic_array[ni.number - 1] = 543;
|
||||
-
|
||||
+ free(ia);
|
||||
// work around unused variable warnings
|
||||
return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
|
||||
|| dynamic_array[ni.number - 1] != 543);
|
||||
--- fig2dev/dev/genps.c
|
||||
+++ fig2dev/dev/genps.c 2021-02-12 09:13:56.896176342 +0000
|
||||
@@ -56,6 +56,7 @@
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
#include <locale.h>
|
||||
+#include <langinfo.h>
|
||||
|
||||
#include "fig2dev.h" /* includes bool.h and object.h */
|
||||
//#include "object.h" /* NUMSHADES, NUMTINTS */
|
||||
@@ -958,9 +959,10 @@ genps_start(F_compound *objects)
|
||||
fprintf(tfp, "%s\n", SPLINE_PS);
|
||||
#ifdef I18N
|
||||
if (support_i18n && iso_text_exist(objects)) {
|
||||
- char *libdir, *locale;
|
||||
- char localefile_buf[128];
|
||||
- char *localefile = localefile_buf;
|
||||
+ char *libdir, *locale, *codeset;
|
||||
+ char *localefile = NULL;
|
||||
+ size_t llen;
|
||||
+ int ret;
|
||||
FILE *fp;
|
||||
libdir = getenv("FIG2DEV_LIBDIR");
|
||||
#ifdef I18N_DATADIR
|
||||
@@ -968,19 +970,30 @@ genps_start(F_compound *objects)
|
||||
libdir = I18N_DATADIR;
|
||||
#endif
|
||||
locale = setlocale(LC_CTYPE, NULL);
|
||||
+ llen = strcspn(locale, ".@");
|
||||
+ codeset = nl_langinfo(CODESET);
|
||||
if (locale == NULL) {
|
||||
fprintf(stderr,
|
||||
"fig2dev: LANG not defined; assuming C locale\n");
|
||||
locale = "C";
|
||||
}
|
||||
- if (strlen(libdir) + strlen(locale) + 5 > sizeof localefile_buf)
|
||||
- localefile = malloc(strlen(libdir) + strlen(locale) + 5);
|
||||
- if (localefile != NULL) {
|
||||
- sprintf(localefile, "%s/%s.ps", libdir, locale);
|
||||
+ retry:
|
||||
+ ret = asprintf(&localefile, "%s/%s.ps", libdir, locale);
|
||||
+ if (ret > 0) {
|
||||
/* get filename like
|
||||
``/usr/local/lib/fig2dev/japanese.ps'' */
|
||||
fp = fopen(localefile, "rb");
|
||||
if (fp == NULL) {
|
||||
+ if (strlen(locale) != llen) {
|
||||
+ free(localefile);
|
||||
+ locale[llen] = '\0';
|
||||
+ goto retry;
|
||||
+ }
|
||||
+ if (codeset && locale != codeset) {
|
||||
+ free(localefile);
|
||||
+ locale = codeset;
|
||||
+ goto retry;
|
||||
+ }
|
||||
fprintf(stderr, "fig2dev: can not open file: %s\n",
|
||||
localefile);
|
||||
} else {
|
||||
@@ -998,11 +1011,10 @@ genps_start(F_compound *objects)
|
||||
"The output might be broken.\n",
|
||||
localefile);
|
||||
}
|
||||
- fclose(fp);
|
||||
+ fclose(fp);
|
||||
}
|
||||
- }
|
||||
- if (localefile != localefile_buf)
|
||||
free(localefile);
|
||||
+ }
|
||||
}
|
||||
#endif /* I18N */
|
||||
|
||||
--- fig2dev/dev/genpstex.c
|
||||
+++ fig2dev/dev/genpstex.c 2021-02-12 09:17:16.360300734 +0000
|
||||
@@ -46,6 +46,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
+#include <sys/stat.h>
|
||||
|
||||
#include "fig2dev.h"
|
||||
#include "object.h"
|
||||
@@ -62,10 +63,13 @@ extern void
|
||||
genps_spline(F_spline *s),
|
||||
genlatex_option(char opt, char *optarg),
|
||||
genlatex_text(F_text *t),
|
||||
- genps_text(F_text *t);
|
||||
+ genps_text(F_text *t),
|
||||
+ genpdf_option(char opt, char *optarg),
|
||||
+ genpdf_start(F_compound *objects);
|
||||
extern int
|
||||
genlatex_end(void),
|
||||
- genps_end(void);
|
||||
+ genps_end(void),
|
||||
+ genpdf_end(void);
|
||||
|
||||
extern void genpdf_option(char opt, char *optarg); /* genpdf.c */
|
||||
extern void genpdf_start(F_compound *objects); /* genpdf.c */
|
||||
--- fig2dev/fig2ps2tex.csh
|
||||
+++ fig2dev/fig2ps2tex.csh 2021-02-12 08:54:37.954704887 +0000
|
||||
@@ -22,7 +22,7 @@
|
||||
# 2016-07-07 Thomas Loimer
|
||||
# * use here-document, instead of echo
|
||||
#
|
||||
-
|
||||
+set echo_style = bsd
|
||||
set bbox = `grep "^%%BoundingBox:" $1`
|
||||
|
||||
set xsp = `echo "3k $bbox[4] $bbox[2] - 72 / p" | dc`
|
||||
--- fig2dev/lib/getopt.c
|
||||
+++ fig2dev/lib/getopt.c 2021-02-12 08:54:37.954704887 +0000
|
||||
@@ -42,6 +42,7 @@
|
||||
#define EMSG ""
|
||||
#define ENDARGS "--"
|
||||
|
||||
+#ifndef __GLIBC__
|
||||
/*
|
||||
* get option letter from argument vector
|
||||
*/
|
||||
@@ -88,3 +89,11 @@ getopt(int nargc, char **nargv, const ch
|
||||
}
|
||||
return optc; /* dump back option letter */
|
||||
}
|
||||
+#else
|
||||
+#include <unistd.h>
|
||||
+int
|
||||
+fig_getopt(int nargc, char * const nargv[], const char *ostr)
|
||||
+{
|
||||
+ return getopt(nargc, nargv, ostr);
|
||||
+}
|
||||
+#endif
|
||||
--- transfig/transfig.c
|
||||
+++ transfig/transfig.c 2021-02-12 08:54:37.954704887 +0000
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
#include "transfig.h"
|
||||
|
||||
extern void sysmv(char *file); /* sys.c */
|
@ -1,10 +1,10 @@
|
||||
---
|
||||
fig2dev-3.2.7b/fig2dev/alloc.h | 20 ++++++++++----------
|
||||
fig2dev-3.2.8/fig2dev/alloc.h | 20 ++++++++++----------
|
||||
1 file changed, 10 insertions(+), 10 deletions(-)
|
||||
|
||||
--- fig2dev-3.2.7b/fig2dev/alloc.h
|
||||
+++ fig2dev-3.2.7b/fig2dev/alloc.h 2019-10-29 10:49:00.939061663 +0000
|
||||
@@ -19,16 +19,16 @@
|
||||
--- fig2dev-3.2.8/fig2dev/alloc.h
|
||||
+++ fig2dev-3.2.8/fig2dev/alloc.h 2021-02-12 09:43:47.313357380 +0000
|
||||
@@ -19,15 +19,15 @@
|
||||
#ifndef ALLOC_H
|
||||
#define ALLOC_H
|
||||
|
||||
@ -29,5 +29,4 @@
|
||||
+#define Control_malloc(z) z = calloc(CONTROL_SIZE,1)
|
||||
+#define Arrow_malloc(z) z = calloc(ARROW_SIZE,1)
|
||||
|
||||
extern char Err_mem[];
|
||||
|
||||
#endif /* ALLOC_H */
|
||||
|
@ -1,14 +0,0 @@
|
||||
---
|
||||
transfig/sys.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- transfig/sys.c
|
||||
+++ transfig/sys.c 2016-09-22 13:02:49.040774112 +0000
|
||||
@@ -39,6 +39,7 @@ sysls(void)
|
||||
i += 1;
|
||||
c = fgetc(ls);
|
||||
}
|
||||
+ pclose(ls);
|
||||
sysbuf[i] = '\0';
|
||||
return sysbuf;
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
---
|
||||
fig2dev/dev/readeps.c | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
--- fig2dev/dev/readeps.c
|
||||
+++ fig2dev/dev/readeps.c 2018-05-07 08:45:37.772825723 +0000
|
||||
@@ -83,9 +83,11 @@ read_eps_pdf(FILE *file, int filetype, F
|
||||
while (fgets(buf, BUFSIZ, file) != NULL) {
|
||||
/* look for /MediaBox for pdf file */
|
||||
if (pdf_flag) {
|
||||
+ char *s;
|
||||
+ for(s=buf; (s=strchr(s,'/')); s++) {
|
||||
if (!strncmp(buf, "/MediaBox", 9)) { /* look for the MediaBox spec */
|
||||
- c = strchr(buf, '[') + 1;
|
||||
- if (c && sscanf(c, "%d %d %d %d", llx, lly, &urx, &ury) < 4)
|
||||
+ c = strchr(s, '[');
|
||||
+ if (c && sscanf(c+1, "%d %d %d %d", llx, lly, &urx, &ury) < 4)
|
||||
{
|
||||
*llx = *lly = 0;
|
||||
urx = paperdef[0].width*72;
|
||||
@@ -93,7 +95,11 @@ read_eps_pdf(FILE *file, int filetype, F
|
||||
put_msg("Bad MediaBox in imported PDF file %s, assuming %s size",
|
||||
pic->file, metric? "A4" : "Letter" );
|
||||
}
|
||||
+ pic->bit_size.x = (urx-(*llx));
|
||||
+ pic->bit_size.y = (ury-(*lly));
|
||||
+ break;
|
||||
}
|
||||
+ }
|
||||
/* look for bounding box for EPS file */
|
||||
} else if (!nested && !strncmp(buf, "%%BoundingBox:", 14)) {
|
||||
c = buf + 14;
|
@ -1,3 +1,61 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 12 09:50:30 UTC 2021 - Dr. Werner Fink <werner@suse.de>
|
||||
|
||||
- Update to fig2dev version 3.2.8 (Patchlevel 8 (Dec 2020)
|
||||
o Use deflate to embed image data into eps output, often substantially
|
||||
reducing file size.
|
||||
o Embed pdf files into ps output by converting the pdf to eps.
|
||||
o Allow negative arrow widths. This might be useful for asymmetric arrow
|
||||
tips, which can thus be mirrored around the corresponding line.
|
||||
Ticket numbers refer to https://sourceforge.net/p/mcj/tickets/#.
|
||||
o Reject negative text font sizes. Fixes ticket #86.
|
||||
o Allow fig files ending without previous eol character. Fixes #83, #84.
|
||||
o Accept text and ellipse angles only within -2*pi to 2*pi. Fixes #76.
|
||||
o Allow -1 as default TeX font, not only 0. Fixes #71, #75, #81.
|
||||
o Do not allow ASCII NUL anywhere in input. Fixes #65, #68, #73, #80.
|
||||
o Use getline() to improve input scanning.
|
||||
Fixes tickets #58, #59, #61, #62, #67, #78, #79, #82.
|
||||
o Correctly scan embedded pdfs for /MediaBox value.
|
||||
o Convert polygons having too few points to polylines. Ticket #56.
|
||||
o Reject huge arrow types causing integer overflow. Ticket #57.
|
||||
o Allow Fig v2 text strings ending with multiple ^A. Ticket #55.
|
||||
o Embed images in pdfs with their original compression type, i.e., leave
|
||||
the gs switch "-dAutoFilterColorImages" at its default value "true".
|
||||
- This update includes the fixes for
|
||||
bsc#1159293 - CVE-2019-19797: transfig,xfig: out-of-bounds write in
|
||||
read_colordef in read.c
|
||||
bsc#1161698 - CVE-2019-19555: transfig,xfig: stack-based buffer
|
||||
overflow because of an incorrect sscanf
|
||||
bsc#1159130 - CVE-2019-19746: transfig,xfig: segmentation fault and
|
||||
out-of-bounds write because of an integer overflow via
|
||||
a large arrow type
|
||||
and many more
|
||||
- Port and rename patch transfig-3.2.6.dif which is now transfig-3.2.8.dif
|
||||
- Remove patches now obsolete
|
||||
* 00cded.patch
|
||||
* 100e27.patch
|
||||
* 2f8d1a.patch
|
||||
* 3065eb.patch
|
||||
* 3165d8.patch
|
||||
* 421afa.patch
|
||||
* 4d4e1f.patch
|
||||
* 639c36.patch
|
||||
* CVE-2019-19555.patch
|
||||
* CVE-2019-19746.patch
|
||||
* CVE-2019-19797.patch
|
||||
* acccc8.patch
|
||||
* c379fe.patch
|
||||
* ca48cc.patch
|
||||
* d6a10d.patch
|
||||
* d70e4b.patch
|
||||
* e3cee2.patch
|
||||
* transfig.3.2.5-binderman.dif
|
||||
* transfig.3.2.5d-mediaboxrealnb.dif
|
||||
- Port patches
|
||||
* fig2dev-3.2.6-fig2mpdf.patch
|
||||
* fig2dev-3.2.6a-RGBFILE.patch
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 30 10:48:31 UTC 2020 - Dr. Werner Fink <werner@suse.de>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package transfig
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -45,34 +45,15 @@ Requires: ghostscript-fonts-std
|
||||
Requires: ghostscript-library
|
||||
Requires: netpbm
|
||||
Requires: texlive-epstopdf
|
||||
Version: 3.2.7b
|
||||
Version: 3.2.8
|
||||
Release: 0
|
||||
Summary: Graphic Converter
|
||||
#Source: http://sourceforge.net/projects/mcj/files/fig2dev-%{version}.tar.xz/download#/fig2dev-%{version}.tar.xz
|
||||
License: MIT
|
||||
Group: Productivity/Graphics/Convertors
|
||||
Source: fig2dev-%{version}.tar.xz
|
||||
Patch0: transfig-3.2.6.dif
|
||||
Patch1: CVE-2019-19555.patch
|
||||
Patch2: transfig.3.2.5-binderman.dif
|
||||
Patch3: transfig.3.2.5d-mediaboxrealnb.dif
|
||||
Patch0: transfig-3.2.8.dif
|
||||
Patch4: transfig-fix-afl.patch
|
||||
Patch5: CVE-2019-19746.patch
|
||||
Patch6: c379fe.patch
|
||||
Patch7: CVE-2019-19797.patch
|
||||
Patch8: 00cded.patch
|
||||
Patch9: d70e4b.patch
|
||||
Patch10: d6a10d.patch
|
||||
Patch11: acccc8.patch
|
||||
Patch12: e3cee2.patch
|
||||
Patch13: 421afa.patch
|
||||
Patch14: 2f8d1a.patch
|
||||
Patch15: 4d4e1f.patch
|
||||
Patch16: 3165d8.patch
|
||||
Patch17: 639c36.patch
|
||||
Patch18: 100e27.patch
|
||||
Patch19: 3065eb.patch
|
||||
Patch20: ca48cc.patch
|
||||
Patch43: fig2dev-3.2.6-fig2mpdf.patch
|
||||
Patch44: fig2dev-3.2.6-fig2mpdf-doc.patch
|
||||
Patch45: fig2dev-3.2.6a-RGBFILE.patch
|
||||
@ -113,27 +94,8 @@ Authors:
|
||||
%setup -q -n fig2dev-%{version}
|
||||
find -type f | xargs -r chmod a-x,go-w
|
||||
%patch0 -p0 -b .0
|
||||
%patch1 -p0 -b .sec
|
||||
%patch2 -p0 -b .bm
|
||||
%patch3 -p0 -b .mbox
|
||||
%patch4 -p1 -b .afl
|
||||
%patch5 -p0 -b .sec2
|
||||
%patch6 -p0 -b .sec3
|
||||
%patch7 -p0 -b .sec4
|
||||
%patch8 -p0 -b .sec5
|
||||
%patch9 -p0 -b .sec6
|
||||
%patch10 -p0 -b .sec7
|
||||
%patch11 -p0 -b .sec8
|
||||
%patch12 -p0 -b .sec9
|
||||
%patch13 -p0 -b .sec10
|
||||
%patch14 -p0 -b .sec11
|
||||
%patch15 -p0 -b .sec12
|
||||
%patch16 -p0 -b .sec13
|
||||
%patch17 -p0 -b .sec14
|
||||
%patch18 -p0 -b .sec15
|
||||
%patch19 -p0 -b .sec16
|
||||
%patch20 -p0 -b .sec17
|
||||
%patch43 -p2 -b .mpdf
|
||||
%patch43 -p1 -b .mpdf
|
||||
%patch44 -p1 -b .mpdfdoc
|
||||
%patch45 -p1 -b .p45
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user