diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2020-02-11 23:05:24 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2020-02-11 23:05:24 +0000 |
commit | bd8dbb9f748c473f5f6bbd0c8b76ce378c1b4249 (patch) | |
tree | b4969f137c62513f3910ce93325e281e4a3bf809 /Build | |
parent | 88fe7722f2fdee1eac872d6c6fbb15d85cf6a6b9 (diff) |
Fix a potential bug in set_default_pdf_filename().
git-svn-id: svn://tug.org/texlive/trunk@53760 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/dvipdfmx.c | 16 |
2 files changed, 16 insertions, 5 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index b10ffcbecf6..65dd64bd44a 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,8 @@ +2020-02-12 Akira Kakuto <kakuto@w32tex.org> + + * dvipdfmx.c: Fix a potential bug in set_default_pdf_filename(). + see https://tug.org/pipermail/tex-live/2020-February/044731.html + 2020-02-06 Shunsaku Hirata <shunsaku.hirata74@gmail.com> * pdfobj.c: In pdf_new_string(), the supplied string was diff --git a/Build/source/texk/dvipdfm-x/dvipdfmx.c b/Build/source/texk/dvipdfm-x/dvipdfmx.c index ce2ba0e60a6..92da42f591b 100644 --- a/Build/source/texk/dvipdfm-x/dvipdfmx.c +++ b/Build/source/texk/dvipdfm-x/dvipdfmx.c @@ -134,15 +134,21 @@ set_default_pdf_filename(void) size_t len = 0; dvi_base = xbasename(dvi_filename); - len = strlen(dvi_base) - strlen(".dvi"); - suffix = dvi_base + len; - if (dpx_conf.compat_mode == dpx_mode_mpost_mode && len > 0 && + + suffix = strrchr(dvi_base, '.'); + /* suffix can be dvi_base if dvi_base is like ".abcde" */ + + if (suffix == NULL || suffix == dvi_base) { + suffix = dvi_base + strlen(dvi_base); + } + len = strlen(dvi_base) - strlen(suffix); + + if (dpx_conf.compat_mode == dpx_mode_mpost_mode && FILESTRCASEEQ(".mps", suffix)) { pdf_filename = NEW(len+strlen(".pdf")+1, char); strncpy(pdf_filename, dvi_base, len); pdf_filename[len] = '\0'; - } else if (len > 0 && - (FILESTRCASEEQ(".dvi", suffix) || + } else if ((FILESTRCASEEQ(".dvi", suffix) || FILESTRCASEEQ(".xdv", suffix))) { pdf_filename = NEW(len+strlen(".pdf")+1, char); strncpy(pdf_filename, dvi_base, len); |