[texlive-bin] 02/03: more complete fix for pdftex match segfault fix from upstream
This is an automated email from the git hooks/post-receive script.
preining pushed a commit to branch master
in repository texlive-bin.
commit 8338a7fbfe4ad2921a55dcd38f5d9ac633e40e5b
Author: Norbert Preining <preining@debian.org>
Date: Mon Jun 13 11:21:22 2016 +0900
more complete fix for pdftex match segfault fix from upstream
---
debian/patches/dvipdfmx-cidtype2-fixes | 27 ------
debian/patches/pdftex-compare-fix-crash | 23 -----
debian/patches/sde_rename_tex_primitive | 60 ------------
debian/patches/series | 4 +-
debian/patches/upstream-svn41418-pdftex-match-fix | 108 ++++++++++++++++++++++
5 files changed, 109 insertions(+), 113 deletions(-)
diff --git a/debian/patches/dvipdfmx-cidtype2-fixes b/debian/patches/dvipdfmx-cidtype2-fixes
deleted file mode 100644
index c88a9ae..0000000
--- a/debian/patches/dvipdfmx-cidtype2-fixes
+++ /dev/null
@@ -1,27 +0,0 @@
-fix problems with dvipdfmx eating characters
-patch by AKira Kakuto and Hironori Kitagawa
-see devel@texjp.org ML, thread starting at post nr 326
----
- texk/dvipdfm-x/cidtype2.c | 10 +++++++---
- 1 file changed, 7 insertions(+), 3 deletions(-)
-
---- texlive-bin.orig/texk/dvipdfm-x/cidtype2.c
-+++ texlive-bin/texk/dvipdfm-x/cidtype2.c
-@@ -653,10 +653,14 @@
- c = h_used_chars[i];
- break;
- }
-+ }
-+ for (i = 8191; i >= 0; i--) {
- if (v_used_chars && v_used_chars[i] != 0) {
-- last_cid = i * 8 + 7;
-- c = v_used_chars[i];
-- break;
-+ if (i*8+7 >= last_cid) {
-+ c = (i*8+7 > last_cid) ? (v_used_chars[i]) : (c | v_used_chars[i]);
-+ last_cid = i * 8 + 7;
-+ break;
-+ }
- }
- }
- if (last_cid > 0) {
diff --git a/debian/patches/pdftex-compare-fix-crash b/debian/patches/pdftex-compare-fix-crash
deleted file mode 100644
index 4c11f9d..0000000
--- a/debian/patches/pdftex-compare-fix-crash
+++ /dev/null
@@ -1,23 +0,0 @@
-fix a segfault in pdftex
-reported by David Carlisle on tex-live
-http://tug.org/pipermail/tex-live/2016-June/038664.html
-proposed fix by Akira Kakuto
-http://tug.org/pipermail/tex-live/2016-June/038666.html
-originally on tex.sx
-http://chat.stackexchange.com/transcript/message/30145736
----
- texk/web2c/pdftexdir/utils.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
---- texlive-bin.orig/texk/web2c/pdftexdir/utils.c
-+++ texlive-bin/texk/web2c/pdftexdir/utils.c
-@@ -870,7 +870,8 @@
- int size, len = 0; /* to avoid warning about uninitialized use of len */
-
- boolean found = i < sub_match_count
-- && match_string != NULL && pmatch[i].rm_so >= 0 && i >= 0;
-+ && match_string != NULL && pmatch[i].rm_so >= 0 && i >= 0
-+ && pmatch[i].rm_eo >= pmatch[i].rm_so;
-
- if (found) {
- len = pmatch[i].rm_eo - pmatch[i].rm_so;
diff --git a/debian/patches/sde_rename_tex_primitive b/debian/patches/sde_rename_tex_primitive
deleted file mode 100644
index 77c1d1c..0000000
--- a/debian/patches/sde_rename_tex_primitive
+++ /dev/null
@@ -1,60 +0,0 @@
----
- texk/web2c/lib/ChangeLog | 2 +-
- texk/web2c/lib/texmfmp.c | 4 ++--
- texk/web2c/man/pdftex.man | 2 +-
- texk/web2c/pdftexdir/NEWS | 2 +-
- 4 files changed, 5 insertions(+), 5 deletions(-)
-
---- texlive-bin.orig/texk/web2c/lib/ChangeLog
-+++ texlive-bin/texk/web2c/lib/ChangeLog
-@@ -16,7 +16,7 @@
-
- * texmfmp.c (init_start_time): new fn, factored out from
- initstarttime.
-- (get_date_and_time): if envvar SOURCE_DATE_EPOCH_TEX_PRIMITIVES
-+ (get_date_and_time): if envvar FORCE_SOURCE_DATE
- is set, initialize minutes, day, month, year, from
- SOURCE_DATE_EPOCH value. Requested by Debian, thread starting at
- http://tug.org/pipermail/tex-k/2016-May/002691.html.
---- texlive-bin.orig/texk/web2c/lib/texmfmp.c
-+++ texlive-bin/texk/web2c/lib/texmfmp.c
-@@ -2247,7 +2247,7 @@
- {
- struct tm *tmptr;
- #ifndef onlyTeX
-- string sde_texprim = getenv ("SOURCE_DATE_EPOCH_TEX_PRIMITIVES");
-+ string sde_texprim = getenv ("FORCE_SOURCE_DATE");
- if (sde_texprim && STREQ (sde_texprim, "1")) {
- init_start_time ();
- tmptr = gmtime (&start_time);
-@@ -2263,7 +2263,7 @@
- /* warn if they gave an invalid value, empty (null string) ok. */
- if (sde_texprim && strlen (sde_texprim) > 0
- && !STREQ (sde_texprim, "0")) {
--WARNING1 ("invalid value (expected 0 or 1) for environment variable $SOURCE_DATE_EPOCH_TEX_PRIMITIVES: %s",
-+WARNING1 ("invalid value (expected 0 or 1) for environment variable $FORCE_SOURCE_DATE: %s",
- sde_texprim);
- }
- #endif /* not onlyTeX */
---- texlive-bin.orig/texk/web2c/man/pdftex.man
-+++ texlive-bin/texk/web2c/man/pdftex.man
-@@ -379,7 +379,7 @@
- timestamps in the PDF output, such as the CreationDate and ModDate keys.
- This is useful for making reproducible builds.
- .TP
--.B SOURCE_DATE_EPOCH_TEX_PRIMITIVES
-+.B FORCE_SOURCE_DATE
- If set to the value "1", the time-related \*(TX primitives
- .RI ( \eyear ,
- .IR \emonth ,
---- texlive-bin.orig/texk/web2c/pdftexdir/NEWS
-+++ texlive-bin/texk/web2c/pdftexdir/NEWS
-@@ -5,7 +5,7 @@
- This by itself should suffice to create reproducible PDFs. The
- new primitives below support more granular output tweaks with the
- same intent.
-- - if the environment variable SOURCE_DATE_EPOCH_TEX_PRIMITIVES is set
-+ - if the environment variable FORCE_SOURCE_DATE is set
- to 1, the \year, \day, and \time primitives are also initialized
- from the SOURCE_DATE_EPOCH value, instead of the current time.
-
diff --git a/debian/patches/series b/debian/patches/series
index ada7de6..9b9df2e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -15,7 +15,5 @@ fix-format-gcc-errors
fix-mktexlsr-bashims
upupstream-xdvi-desktop-file
SDE-support-for-luatex
-#dvipdfmx-cidtype2-fixes
-#pdftex-compare-fix-crash
-#sde_rename_tex_primitive
upstream-svn41417-rename-sdetp
+upstream-svn41418-pdftex-match-fix
diff --git a/debian/patches/upstream-svn41418-pdftex-match-fix b/debian/patches/upstream-svn41418-pdftex-match-fix
new file mode 100644
index 0000000..862d2d8
--- /dev/null
+++ b/debian/patches/upstream-svn41418-pdftex-match-fix
@@ -0,0 +1,108 @@
+fix pdftex match segfaults
+---
+ texk/web2c/pdftexdir/ChangeLog | 14 ++++++++++++++
+ texk/web2c/pdftexdir/NEWS | 5 ++++-
+ texk/web2c/pdftexdir/utils.c | 30 +++++++++++++++++++++++-------
+ 3 files changed, 41 insertions(+), 8 deletions(-)
+
+--- texlive-bin.orig/texk/web2c/pdftexdir/ChangeLog
++++ texlive-bin/texk/web2c/pdftexdir/ChangeLog
+@@ -1,3 +1,17 @@
++2016-06-12 Karl Berry <karl@freefriends.org>
++ and Akira Kakuto <kakuto@fuk.kindai.ac.jp>
++
++ * utils.c (last_match_succeeded): new static boolean.
++ (matchstrings): set it.
++ (getmatch): use it, plus check for non-NULL match_string sooner,
++ plus check that rm_eo >= rm_so.
++ Original bug report from David Carlisle,
++ http://tug.org/pipermail/tex-live/2016-June/038664.html
++
++2016-05-20 Karl Berry <karl@tug.org>
++
++ * TeX Live 2016 release.
++
+ 2016-04-06 Karl Berry <karl@tug.org>
+
+ * pdftexextra.h (COPYRIGHT_HOLDER): don't specifically mention peb
+--- texlive-bin.orig/texk/web2c/pdftexdir/NEWS
++++ texlive-bin/texk/web2c/pdftexdir/NEWS
+@@ -1,8 +1,11 @@
+ - changes:
+ - rename envvar SOURCE_DATE_EPOCH_TEX_PRIMITIVES to FORCE_SOURCE_DATE;
+ no changes in functionality.
++
++- bugfixes:
++ - \pdflastmatch more reliable when there was no match
+ ---------------------------------------------------
+-pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016)
++pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016) (May 20, 2016)
+ - changes:
+ - if the environment variable SOURCE_DATE_EPOCH is set, use its value for
+ the PDF CreationDate and ModDate values, and to seed the trailer /ID.
+--- texlive-bin.orig/texk/web2c/pdftexdir/utils.c
++++ texlive-bin/texk/web2c/pdftexdir/utils.c
+@@ -817,12 +817,16 @@
+ pdf_printf("/ModDate (%s)\n", start_time_str);
+ }
+
++
+ #define DEFAULT_SUB_MATCH_COUNT 10
+ static int sub_match_count = DEFAULT_SUB_MATCH_COUNT;
+ static regmatch_t *pmatch = NULL;
+ static char *match_string = NULL;
++static int last_match_succeeded = 0;
+
+-void matchstrings(strnumber s, strnumber t, int subcount, boolean icase)
++/* Implements \pdfmatch */
++void
++matchstrings(strnumber s, strnumber t, int subcount, boolean icase)
+ {
+ regex_t preg;
+ int cflags = REG_EXTENDED;
+@@ -857,20 +861,31 @@
+ pmatch = xtalloc(sub_match_count, regmatch_t);
+ }
+ ret = regexec(&preg, str, sub_match_count, pmatch, eflags);
++
+ xfree(match_string);
+- match_string = xstrdup(str);
+- strpool[poolptr++] = ((ret == 0) ? '1' : '0');
++ match_string = xstrdup(str); /* save searched-in string, used below */
++ last_match_succeeded = ret == 0; /* save whether match succeeded */
++ strpool[poolptr++] = ((ret == 0) ? '1' : '0'); /* in string pool too */
+ }
+
+ regfree(&preg);
+ }
+
+-void getmatch(int i)
++/* Implements \pdflastmatch */
++
++void
++getmatch(int i)
+ {
+- int size, len = 0; /* to avoid warning about uninitialized use of len */
++ int size;
++ int len = 0; /* avoid spurious uninitialized warning */
+
+- boolean found = i < sub_match_count
+- && match_string != NULL && pmatch[i].rm_so >= 0 && i >= 0;
++ boolean found
++ = i >= 0 /* should always be so due to pdftex.web */
++ && i < sub_match_count /* if >subcount, not found by definition */
++ && match_string != NULL /* first call, and just in case */
++ && last_match_succeeded /* if no match, not found */
++ && pmatch[i].rm_so >= 0 /* if no starting position, not found */
++ && pmatch[i].rm_eo >= pmatch[i].rm_so; /* just in case */
+
+ if (found) {
+ len = pmatch[i].rm_eo - pmatch[i].rm_so;
+@@ -903,6 +918,7 @@
+ strpool[poolptr++] = '>';
+ }
+
++
+ /* function strips trailing zeros in string with numbers; */
+ /* leading zeros are not stripped (as in real life) */
+ char *stripzeros(char *a)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-tex/texlive-bin.git
Reply to: