about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2017-12-09 15:46:13 -0600
committerWill Dietz <w@wdtz.org>2017-12-09 16:05:49 -0600
commit5c814534778052061c6168c3b19a23bf2498759a (patch)
tree44392a68aa82a27f0fef1c05c6f953b082331936
parent80b6ef9f199eb111cac92d24d1a32ec2531f430f (diff)
tetex: patch off-by-one to fix segfault
Fixes #32264.

Patch based on one from Fedora texlive-2007-66 source rpm.

References:
https://bugzilla.redhat.com/show_bug.cgi?id=754517
http://tug.org/pipermail/tex-k/2011-July/002317.html
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=633011
https://www.mail-archive.com/tetex@dbs.uni-hannover.de/msg00968.html

Redhat discussion suggests this happens when using -Wl,-z,relro
(or other linker flags) that change the default memory layout.
-rw-r--r--pkgs/tools/typesetting/tex/tetex/default.nix2
-rw-r--r--pkgs/tools/typesetting/tex/tetex/extramembot.patch12
2 files changed, 13 insertions, 1 deletions
diff --git a/pkgs/tools/typesetting/tex/tetex/default.nix b/pkgs/tools/typesetting/tex/tetex/default.nix
index 313474745d108..ac317fd51dcba 100644
--- a/pkgs/tools/typesetting/tex/tetex/default.nix
+++ b/pkgs/tools/typesetting/tex/tetex/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
     find ./ -name "config.guess" -exec rm {} \; -exec ln -s ${automake}/share/automake-*/config.guess {} \;
   '' else null;
 
-  patches = [ ./environment.patch ./getline.patch ./clang.patch ];
+  patches = [ ./environment.patch ./getline.patch ./clang.patch ./extramembot.patch ];
 
   setupHook = ./setup-hook.sh;
 
diff --git a/pkgs/tools/typesetting/tex/tetex/extramembot.patch b/pkgs/tools/typesetting/tex/tetex/extramembot.patch
new file mode 100644
index 0000000000000..f6c954fcfa5c8
--- /dev/null
+++ b/pkgs/tools/typesetting/tex/tetex/extramembot.patch
@@ -0,0 +1,12 @@
+diff -up texlive-2007/texk/web2c/tex.ch.extramembot texlive-2007/texk/web2c/tex.ch
+--- texlive-2007/texk/web2c/tex.ch.extramembot	2006-12-19 02:11:11.000000000 +0100
++++ texlive-2007/texk/web2c/tex.ch	2011-11-30 12:03:32.052795763 +0100
+@@ -365,7 +365,7 @@ for i:=@'177 to @'377 do xchr[i]:=i;
+ {Initialize enc\TeX\ data.}
+ for i:=0 to 255 do mubyte_read[i]:=null;
+ for i:=0 to 255 do mubyte_write[i]:=0;
+-for i:=0 to 128 do mubyte_cswrite[i]:=null;
++for i:=0 to 127 do mubyte_cswrite[i]:=null;
+ mubyte_keep := 0; mubyte_start := false; 
+ write_noexpanding := false; cs_converting := false;
+ special_printing := false; message_printing := false;