diff options
Diffstat (limited to 'Build/source/texk/dviljk')
-rw-r--r-- | Build/source/texk/dviljk/ChangeLog | 2 | ||||
-rw-r--r-- | Build/source/texk/dviljk/dvi2xx.c | 19 |
2 files changed, 16 insertions, 5 deletions
diff --git a/Build/source/texk/dviljk/ChangeLog b/Build/source/texk/dviljk/ChangeLog index c51e85e9d6f..65354398eb6 100644 --- a/Build/source/texk/dviljk/ChangeLog +++ b/Build/source/texk/dviljk/ChangeLog @@ -9,6 +9,8 @@ operations. (DoSpecial): Call of ghostscript for psfile special had also a potential buffer overflow caused by unchecked usage of sprintf. + Fix core dump: Check if all required parameters of psfile special + are passed. Bumped version number up to 2.6p3. diff --git a/Build/source/texk/dviljk/dvi2xx.c b/Build/source/texk/dviljk/dvi2xx.c index 6c6459df911..36f52d56e72 100644 --- a/Build/source/texk/dviljk/dvi2xx.c +++ b/Build/source/texk/dviljk/dvi2xx.c @@ -3910,7 +3910,7 @@ int n; static int GrayScale = 10, Pattern = 1; static bool GrayFill = _TRUE; static long4 p_x[MAX_SPECIAL_DEFPOINTS], p_y[MAX_SPECIAL_DEFPOINTS]; - int llx=0, lly=0, urx=0, ury=0, rwi=0, rhi=0; + int llx=0, lly=0, urx=0, ury=0, rwi=0; str[n] = '\0'; for ( i=0 ; i<MAX_SPECIAL_DEFPOINTS ; i++ ) @@ -4094,7 +4094,10 @@ int n; case URX: urx = k.v.i; break; case URY: ury = k.v.i; break; case RWI: rwi = k.v.i; break; - case RHI: rhi = k.v.i; break; + case RHI: + if (!kpse_tex_hush ("special")) + Warning("Whatever rhi was good for once, it is ignored now."); + break; default: #ifdef KPATHSEA @@ -4137,9 +4140,7 @@ int n; char cmd[255]; char *cmd_format = "%s -q -dSIMPLE -dSAFER -dNOPAUSE -sDEVICE=%s -sOutputFile=%s %s %s showpage.ps -c quit"; char *gs_cmd; - int scale_factor = 3000 * width / rwi; - int adjusted_height = height * 300/scale_factor; - int adjusted_llx = llx * 300/scale_factor; + int scale_factor, adjusted_height, adjusted_llx; char *printer = "ljetplus"; /* use the most stupid one */ @@ -4148,6 +4149,14 @@ int n; char *pcl_file = tmpnam(NULL); FILEPTR scalef; + if ( urx == 0 || ury == 0 || rwi == 0 ) { + Warning ("Ignoring psfile special without urx, ury and rwi attributes"); + return; + } + scale_factor = 3000 * width / rwi; + adjusted_height = height * 300/scale_factor; + adjusted_llx = llx * 300/scale_factor; + if ( (scalef = BOUTOPEN(scale_file)) == FPNULL ) { Warning("Unable to open file %s for writing", scale_file ); return; |