Accepting request 74035 from graphics

- Fix broken append mode for eps/ps import (bnc#696368)

OBS-URL: https://build.opensuse.org/request/show/74035
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xfig?expand=0&rev=25
This commit is contained in:
Sascha Peilicke 2011-06-20 08:50:09 +00:00 committed by Git OBS Bridge
commit f15ac08138
2 changed files with 18 additions and 7 deletions

View File

@ -1,12 +1,13 @@
--- f_readeps.c
+++ f_readeps.c 2010-12-01 14:26:05.884195851 +0000
+++ f_readeps.c 2011-06-17 12:46:08.519926308 +0000
@@ -252,11 +252,12 @@ bitmap_from_gs(file, filetype, pic, urx,
{
char buf[300];
FILE *tmpfp, *pixfile, *gsfile;
- char *psnam, *driver;
- int status, wid, ht, nbitmap, fd;
+ char *driver;
int status, wid, ht, nbitmap, fd;
+ int status, wid, ht, nbitmap, fd, len;
char tmpfile[PATH_MAX],
pixnam[PATH_MAX],
errnam[PATH_MAX],
@ -14,7 +15,7 @@
gscom[2 * PATH_MAX];
wid = urx - llx;
@@ -307,19 +308,22 @@ bitmap_from_gs(file, filetype, pic, urx,
@@ -307,19 +308,26 @@ bitmap_from_gs(file, filetype, pic, urx,
/* for color, use pcx */
driver = "pcx256";
}
@ -31,7 +32,7 @@
+ if (!realpath(tmpfile, psnam)) {
+ file_msg("Cannot canonicalize %s: %s\n", tmpfile, strerror(errno));
+ return False;
}
+ }
+ /* From Language.htm of ghostscript 9.00 and higher:
+ * If Ghostscript is started with -dNOSAFER or -dDELAYSAFER, this operator can
+ * be used to enter SAFER mode with the current set of PermitFile... user
@ -40,11 +41,16 @@
+ * for file Reading, Writing and/or Control can use this operator to perform
+ * the locking needed to enter SAFER mode.
+ */
sprintf(&gscom[strlen(gscom)],
- "%s -r72x72 -dSAFER -sDEVICE=%s -g%dx%d -sOutputFile=%s -q - > %s 2>&1",
- appres.ghostscript, driver, wid, ht, pixnam, errnam);
+ len = snprintf(gscom, sizeof(gscom) - 1,
+ "%s -r72x72 -sDEVICE=%s -g%dx%d -dDELAYSAFER -sOutputFile=%s -c '<</PermitFileReading[(%s)]>> setuserparams .locksafe' -q - > %s 2>&1",
+ appres.ghostscript, driver, wid, ht, pixnam, psnam, errnam);
+ if (len >= sizeof(gscom) - 1 || len < 0) {
+ file_msg("Cannot write to buffer, file name to large: %s\n", psnam);
+ return False;
}
- sprintf(&gscom[strlen(gscom)],
- "%s -r72x72 -dSAFER -sDEVICE=%s -g%dx%d -sOutputFile=%s -q - > %s 2>&1",
- appres.ghostscript, driver, wid, ht, pixnam, errnam);
if (appres.DEBUG)
fprintf(stderr,"calling: %s\n",gscom);
if ((gsfile = popen(gscom, "w")) == 0) {

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Jun 17 15:07:40 CEST 2011 - werner@suse.de
- Fix broken append mode for eps/ps import (bnc#696368)
-------------------------------------------------------------------
Fri Dec 3 15:23:11 CET 2010 - werner@suse.de