diff options
author | Joachim Schrod <jschrod@acm.org> | 2007-06-28 13:22:22 +0000 |
---|---|---|
committer | Joachim Schrod <jschrod@acm.org> | 2007-06-28 13:22:22 +0000 |
commit | 4bac701862c1ca9aa0a3e39789d2ac6afc7f4927 (patch) | |
tree | 4b9e204a601240b5806ad5fbe8ab88ded9aab246 /Build/source | |
parent | 405dd674e335843ede7817de9697c50e696c13bb (diff) |
Fix core dump: Check mandatory parameters for psfile special.
git-svn-id: svn://tug.org/texlive/trunk@4525 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-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; |