Bug#633011: /usr/bin/tex crashes on every *.tex file
Package: texlive-binaries
Version: 2009-8+b1
Severity: normal
Tags: sid
To reproduce
$ > foo.tex # but any other .tex file will do
$ tex foo.tex
This is TeX, Version 3.1415926 (TeX Live 2009/Debian)
Segmentation fault
This is due to an longstanding off-by-one error during initialization (even
before loading a .fmt file):
In Web (Pascal) source we have
mubyte_cswrite: array [0..127] of pointer;
and later this array is initialized with
for i:=0 to 128 do mubyte_cswrite[i]:=null;
Why hasn't this caused any problems before the latest (2009-8+b1) bin-NMU?
My guess is that the GNU linker now produces another memory layout.
Note that in the generated C source global variables like the above array are
only declared "extern halfword mubytecswrite[128]", but are never defined.
Hence their linkage is "common" and the linker is free to use any layout.
For me mubytecswrite [128] is at the same address as extramembot (C variable
names)
and the later the has the value -268435455L (that's what's used for Pascal's
"null").
This is very unfortunate because extramembot is supposed to be positive and
this leads to totally bogus pointer calculations resulting in a segfault.
Suggested patch attached.
Cheers, Roderich
-- System Information:
Debian Release: wheezy/sid
APT prefers oneiric
APT policy: (500, 'oneiric'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.39.2 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages texlive-binaries depends on:
ii ed 1.5-1 The classic UNIX line editor
ii libc6 2.13-10 Embedded GNU C Library: Shared lib
ii libfontconfig1 2.8.0-3 generic font configuration library
ii libfreetype6 2.4.4-2 FreeType 2 font engine, shared lib
ii libgcc1 1:4.6.1-2 GCC support library
ii libkpathsea5 2009-8+b1 TeX Live: path search library for
ii libncurses5 5.9-1 shared libraries for terminal hand
ii libpaper1 1.1.24+nmu1 library for handling paper charact
ii libpng12-0 1.2.44-2 PNG library - runtime
ii libpoppler13 0.16.7-2 PDF rendering library
ii libstdc++6 4.6.1-2 GNU Standard C++ Library v3
ii libx11-6 2:1.4.3-2 X11 client-side library
ii libxaw7 2:1.0.9-2 X11 Athena Widget library
ii libxmu6 2:1.1.0-2 X11 miscellaneous utility library
ii libxpm4 1:3.5.9-1 X11 pixmap library
ii libxt6 1:1.1.1-2 X11 toolkit intrinsics library
ii perl 5.14.0-1 Larry Wall's Practical Extraction
ii tex-common 2.10 common infrastructure for building
ii texlive-common 2009-11 TeX Live: Base component
ii zlib1g 1:1.2.5.dfsg-1 compression library - runtime
texlive-binaries recommends no packages.
texlive-binaries suggests no packages.
-- no debconf information
--- a/texk/web2c/tex.ch 2011-07-07 21:26:55.779344956 +0200
+++ b/texk/web2c/tex.ch 2009-08-12 23:40:14.000000000 +0200
@@ -371,7 +371,7 @@
{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;
--- a/texk/web2c/xetexdir/xetex.ch 2011-07-07 21:26:55.779344956 +0200
+++ b/texk/web2c/xetexdir/xetex.ch 2011-07-07 21:26:55.779344956 +0200
@@ -335,7 +335,7 @@
{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;
Reply to: