diff options
author | Karl Berry <karl@freefriends.org> | 2009-05-08 16:44:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-05-08 16:44:52 +0000 |
commit | e466b85f007f70bae104d8fe0c9173a0707d1626 (patch) | |
tree | e2d4f0056e39f55deb8b700a935d3041d921bdee /Build/source/texk | |
parent | a8f991d5257a1bc5d95b671d702e5183bfb91e4e (diff) |
avoid accessing unallocated memory, from Akira; prettify related errors
git-svn-id: svn://tug.org/texlive/trunk@13011 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/dvipsk/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/dvipsk/dvips.c | 15 | ||||
-rw-r--r-- | Build/source/texk/dvipsk/resident.c | 2 |
3 files changed, 16 insertions, 8 deletions
diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog index 7ec0655a12c..5167f50475d 100644 --- a/Build/source/texk/dvipsk/ChangeLog +++ b/Build/source/texk/dvipsk/ChangeLog @@ -1,3 +1,10 @@ +2009-05-08 Karl Berry <karl@tug.org> + + * resident.c (getpsinfo): avoid accessing unallocated downbuf[-1]. + * dvips.c (main): do not check iname[-1] if there is no iname. + Reports from Akira. + Also prettify some related error messages. + 2009-04-04 Karl Berry <karl@tug.org> * writet1.c (append_cs_return): new fn. diff --git a/Build/source/texk/dvipsk/dvips.c b/Build/source/texk/dvipsk/dvips.c index 7f1bb9cd08e..8a310219135 100644 --- a/Build/source/texk/dvipsk/dvips.c +++ b/Build/source/texk/dvipsk/dvips.c @@ -1175,7 +1175,8 @@ default: } if (oname[0] == '-' && oname[1] == 0) oname[0] = 0 ; - else if (*oname == 0 && ! filter) { + else if (*oname == 0 && ! filter && *iname) { + /* determine output name from input name */ oname = nextstring ; #ifndef VMCMS /* get stuff before LAST "." */ lastext = strlen(iname) - 1 ; @@ -1281,21 +1282,21 @@ default: SET_BINARY(fileno(stdin)) ; } else { #ifdef KPATHSEA - fprintf (stderr, "Missing DVI file argument (or -f).\n"); - fprintf (stderr, "Try --help for more information.\n"); + fprintf (stderr, "dvips: Missing DVI file argument (or -f).\n"); + fprintf (stderr, "dvips: Try --help for more information.\n"); #else help(1) ; #endif exit(1) ; } - initcolor() ; if (dvifile==NULL) { - extern char errbuf[]; - (void)sprintf(errbuf,"! DVI file <%s> can't be opened.", iname) ; - error("! DVI file can't be opened.") ; + error_with_perror("DVI file can't be opened:", iname); + exit(1); } if (fseek(dvifile, 0L, 0) < 0) error("! DVI file must not be a pipe.") ; + + initcolor() ; #ifdef FONTLIB fliload(); /* read the font libaries */ #endif diff --git a/Build/source/texk/dvipsk/resident.c b/Build/source/texk/dvipsk/resident.c index ec3f7b4d326..9b8be0f8927 100644 --- a/Build/source/texk/dvipsk/resident.c +++ b/Build/source/texk/dvipsk/resident.c @@ -964,7 +964,7 @@ void getpsinfo P1C(char *, name) if (downloadinfo) strcat(downbuf, downloadinfo) ; slen = strlen(downbuf) - 1; - if (downbuf[slen] == ' ') { + if (slen > 0 && downbuf[slen] == ' ') { downbuf[slen] = 0; } if (TeXname) { |