summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-03-20 00:22:30 +0000
committerKhaled Hosny <khaledhosny@eglug.org>2013-03-20 00:22:30 +0000
commitf430c604365ab3fc4af3a80e3f1f3f0eac53f3f7 (patch)
treedb758352ffa583eedd8d4d234de24b05b9715666 /Build
parent68dffa17a92352655e02a75df8023da14932ac97 (diff)
Don't crash when temporary file creation fail
git-svn-id: svn://tug.org/texlive/trunk@29437 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/xdvipdfmx/ChangeLog36
-rw-r--r--Build/source/texk/xdvipdfmx/src/spc_dvips.c29
2 files changed, 48 insertions, 17 deletions
diff --git a/Build/source/texk/xdvipdfmx/ChangeLog b/Build/source/texk/xdvipdfmx/ChangeLog
index a21e0552304..7787524aed7 100644
--- a/Build/source/texk/xdvipdfmx/ChangeLog
+++ b/Build/source/texk/xdvipdfmx/ChangeLog
@@ -1,23 +1,29 @@
+2013-03-20 Khaled Hosny <khaledhosny@eglug.org>
+
+ * spc_dvips.c (spc_handler_ps_tricks_pdef, spc_handler_ps_tricks_tdef,
+ spc_handler_ps_tricks_bput, spc_dvips_at_begin_document, calculate_PS):
+ Don't crash when temporary file creation fail.
+
2013-03-15 Peter Breitenlohner <peb@mppmu.mpg.de>
- * dvi.c (dvi_locate_native_font): Drop unused variable.
+ * dvi.c (dvi_locate_native_font): Drop unused variable.
2013-03-14 Khaled Hosny <khaledhosny@eglug.org>
- * src/dvi.c, src/dvicodes.h, vf.c: Revert "Support DVI-IVD inspired text
- reflection for XeTeX".
- * src/fontmap.c: Remove commented out old Mac code.
- * src/fontmap.c (pdf_load_native_font_from_path, pdf_load_native_font):
- Merge.
- * src/dvi.c, src/fontmap.c, src/fontmap.h: Ignore native font family and
- style names that we no longer use.
- * src/dvi.c (read_native_font_record, do_native_font_def): Don't check
- for XDV_FLAG_FONTTYPE_* flags as they do nothing.
- * src/dvi.c (do_glyph_array): Use FT_Get_Advance() instead of the slower
- FT_Load_Glyph().
- * src/dvi.c, src/fontmap.c, src/fontmap.h: Drop no longer needed
- glyph_widths cache.
- * dvi.c: Drop unneeded includes.
+ * src/dvi.c, src/dvicodes.h, vf.c: Revert "Support DVI-IVD inspired text
+ reflection for XeTeX".
+ * src/fontmap.c: Remove commented out old Mac code.
+ * src/fontmap.c (pdf_load_native_font_from_path, pdf_load_native_font):
+ Merge.
+ * src/dvi.c, src/fontmap.c, src/fontmap.h: Ignore native font family and
+ style names that we no longer use.
+ * src/dvi.c (read_native_font_record, do_native_font_def): Don't check
+ for XDV_FLAG_FONTTYPE_* flags as they do nothing.
+ * src/dvi.c (do_glyph_array): Use FT_Get_Advance() instead of the slower
+ FT_Load_Glyph().
+ * src/dvi.c, src/fontmap.c, src/fontmap.h: Drop no longer needed
+ glyph_widths cache.
+ * dvi.c: Drop unneeded includes.
2013-02-25 Peter Breitenlohner <peb@mppmu.mpg.de>
diff --git a/Build/source/texk/xdvipdfmx/src/spc_dvips.c b/Build/source/texk/xdvipdfmx/src/spc_dvips.c
index 0a6369f97ec..94d21ae98da 100644
--- a/Build/source/texk/xdvipdfmx/src/spc_dvips.c
+++ b/Build/source/texk/xdvipdfmx/src/spc_dvips.c
@@ -57,7 +57,6 @@
#include "epdf.h"
-
static int block_pending = 0;
static double pending_x = 0.0;
static double pending_y = 0.0;
@@ -319,8 +318,14 @@ spc_handler_ps_tricks_pdef (struct spc_env *spe, struct spc_arg *args)
T.e = pt.x;
T.f = pt.y;
pdf_concatmatrix(&M, &T);
- if (page_defs == 0)
+
+ if (!page_defs)
page_defs = dpx_create_temp_file();
+ if (!page_defs) {
+ WARN("Failed to create temporary input file for PSTricks image conversion.");
+ return -1;
+ }
+
fp = fopen(page_defs, "ab");
fprintf(fp, "gsave initmatrix [%f %f %f %f %f %f] concat %f %f moveto\n", M.a, M.b, M.c, M.d, M.e, M.f, spe->x_user - pt.x, spe->y_user - pt.y);
fwrite(args->curptr, 1, args->endptr - args->curptr, fp);
@@ -336,6 +341,11 @@ spc_handler_ps_tricks_tdef (struct spc_env *spe, struct spc_arg *args)
FILE* fp;
if (!temporary_defs)
temporary_defs = dpx_create_temp_file();
+ if (!temporary_defs) {
+ WARN("Failed to create temporary input file for PSTricks image conversion.");
+ return -1;
+ }
+
fp = fopen(temporary_defs, "wb");
fwrite(args->curptr, 1, args->endptr - args->curptr, fp);
fprintf(fp, "\n");
@@ -391,6 +401,11 @@ spc_handler_ps_tricks_bput (struct spc_env *spe, struct spc_arg *args, int must_
FILE* fp;
if (!temporary_defs)
temporary_defs = dpx_create_temp_file();
+ if (!temporary_defs) {
+ WARN("Failed to create temporary input file for PSTricks image conversion.");
+ return -1;
+ }
+
fp = fopen(temporary_defs, "ab");
fprintf(fp, "gsave\n");
if (label == 0)
@@ -885,6 +900,11 @@ spc_dvips_at_begin_document (void)
/* This, together with \pscharpath support code, must be moved to xtex.pro header. */
global_defs = dpx_create_temp_file();
+ if (!global_defs) {
+ WARN("Failed to create temporary input file for PSTricks image conversion.");
+ return -1;
+ }
+
fp = fopen(global_defs, "wb");
fprintf(fp, "tx@Dict begin /STV {} def end\n");
fclose(fp);
@@ -1002,6 +1022,11 @@ int calculate_PS (char *string, int length, double *res1, double *res2, double *
if (res1 == 0 && res2 == 0)
return -1;
formula = dpx_create_temp_file();
+ if (!formula) {
+ WARN("Failed to create temporary input file for PSTricks image conversion.");
+ return -1;
+ }
+
fp = fopen(formula, "wb");
for (k = 0; k < num_ps_headers; k++)
fprintf(fp, "(%s) run\n", ps_headers[k]);