summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2012-09-15 10:13:22 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2012-09-15 10:13:22 +0000
commit909cf43a7ef2ddd0f8e0da8c18ba72aede8cf61c (patch)
tree6a7c0b9649e7426d7711ddc1ada6de1d2ebbf3db /Build
parent2defda0c5c4525a0cfaa0064435ebb8ee7cc3197 (diff)
On Windows, use $SELFAUTOLOC/xdvipdfmx.exe as a driver for security reason
git-svn-id: svn://tug.org/texlive/trunk@27676 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/xetexdir/ChangeLog7
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.c41
2 files changed, 45 insertions, 3 deletions
diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog
index ff354e6af45..a72d840f568 100644
--- a/Build/source/texk/web2c/xetexdir/ChangeLog
+++ b/Build/source/texk/web2c/xetexdir/ChangeLog
@@ -1,3 +1,10 @@
+2012-09-15 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * XeTeX_ext.c (open_dvi_output): sync with W32TeX. On Windows,
+ use $SELFAUTOLOC/xdvipdfmx.exe as a driver for security reason.
+ Otherwise a malicious xdvipdfmx.bat in the current directory can
+ be called.
+
2012-08-10 Peter Breitenlohner <peb@mppmu.mpg.de>
* XeTeXFontMgr.cpp, XeTeXLayoutInterface.cpp: Always put
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
index c6b1e420583..34ee436f827 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -70,6 +70,9 @@ authorization from the copyright holders.
#include <kpathsea/readable.h>
#include <kpathsea/variable.h>
#include <kpathsea/absolute.h>
+#if defined(WIN32)
+#include <kpathsea/concatn.h>
+#endif
#include <math.h> /* for fabs() */
@@ -470,7 +473,7 @@ static UInt32 *utf32Buf = NULL;
/* Trim trailing whitespace. */
while (last > first && ISBLANK(buffer[last - 1]))
--last;
-
+
return true;
}
@@ -1130,7 +1133,7 @@ loadGraphiteFont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, con
}
goto next_option;
}
-
+
if (strncmp(cp1, "rtl", 3) == 0) {
cp3 = cp2;
if (*cp3 == ';' || *cp3 == ':')
@@ -2157,7 +2160,7 @@ measure_native_node(void* pNode, int use_glyph_metrics)
void* glyph_info = 0;
static float* positions = 0;
static UInt32* glyphs = 0;
- static int maxGlyphs = 0;
+ static int maxGlyphs = 0;
UBiDi* pBiDi = ubidi_open();
@@ -2968,6 +2971,14 @@ u_open_in(unicodefile* f, integer filefmt, const_string fopen_mode, integer mode
return rval;
}
+#if defined(WIN32)
+static int
+Isspace(char c)
+{
+ return (c == ' ' || c == '\t');
+}
+#endif
+
int
open_dvi_output(FILE** fptr)
{
@@ -3019,7 +3030,31 @@ open_dvi_output(FILE** fptr)
strcpy((char*)nameoffile+1, fullname);
free(fullname);
}
+#if defined(WIN32)
+ {
+ char *p, *pp, *bindir, *fullcmd, *prgnam;
+ bindir = kpse_var_value("SELFAUTOLOC");
+ for(pp = bindir; *pp; pp++) {
+ if(*pp == '/') *pp = '\\';
+ }
+ pp = cmd;
+ while(Isspace(*pp))
+ pp++;
+ prgnam = xmalloc(strlen(cmd));
+ p = prgnam;
+ while(!Isspace(*pp)) {
+ *p++ = *pp++;
+ }
+ *p = '\0';
+ fullcmd = concatn("\"", bindir, "\\", prgnam, "\"", pp, NULL);
+ *fptr = popen(fullcmd, "w");
+ free(bindir);
+ free(prgnam);
+ free(fullcmd);
+ }
+#else
*fptr = popen(cmd, "w");
+#endif
free(cmd);
return (*fptr != 0);
}