Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 915782

Summary: dev-tex/tex4ht-20090611_p1038_p20210603: segmentation fault in tex4ht binary at runtime
Product: Gentoo Linux Reporter: Oliver Freyermuth <o.freyermuth>
Component: Current packagesAssignee: TeX project <tex>
Status: RESOLVED FIXED    
Severity: normal CC: o.freyermuth, ulm
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://puszcza.gnu.org.ua/bugs/?611
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch fixing invalid read and accesses to undefined variables

Description Oliver Freyermuth 2023-10-14 20:32:52 UTC
Current package in tree is versioned 20090611_p1038_p20210603, and seems to be based on a dead SRC_URI ( https://cse.osu.edu/~gurari/TeX4ht/fix/tex4ht-1.0.2009_06_11_1038.tar.gz ) which luckily is still on mirrors. 

Actual upstream is still alive and recently added some fixes for long-standing memory issues (invalid reads etc.):
https://svn.gnu.org.ua/viewvc/tex4ht/trunk/lit/tex4ht-c.tex?view=log

It would be good to see a new snapshot packaged using upstream as source with those fixes included. 

Might be blocked by:
https://bugs.gentoo.org/836779 (TeXlive version bump)

Reproducible: Always
Comment 1 Ulrich Müller gentoo-dev 2023-10-15 12:40:05 UTC
It's somewhat complicated. The package is based on the last release from Eitan Gurari, and we add/replace the parts that are available with the TeXLive distribution (which misses some directories).

In other words, large parts of the package are a snapshot from https://mirrors.ctan.org/systems/texlive/tlnet/archive/tex4ht.tar.xz corresponding to the latest TeXLive that is packaged in Gentoo (which is 2021, at the time being).

(In reply to Oliver Freyermuth from comment #0)
> It would be good to see a new snapshot packaged using upstream as source
> with those fixes included. 

An unsynced update of the snapshot is generally not a good idea and has caused problems in the past.

However, I'd be happy to apply a patch for the memory issue if you attach it here.
Comment 2 Oliver Freyermuth 2023-10-15 15:37:05 UTC
Created attachment 872926 [details, diff]
Patch fixing invalid read and accesses to undefined variables

(In reply to Ulrich Müller from comment #1)
> An unsynced update of the snapshot is generally not a good idea and has
> caused problems in the past.
> 
> However, I'd be happy to apply a patch for the memory issue if you attach it
> here.

I see, that's very understandable. 

I have attached a patch which incorporates commits r1387 and r1391 from https://svn.gnu.org.ua/viewvc/tex4ht/trunk/ , which are present in TeXlive as r68541 (c.f. https://tug.org/svn/texlive/trunk/Build/source/texk/tex4htk/tex4ht.c ). 

Kudos go to Karl Berry, who has taken over from Eitan Gurari, for developing the actual patch after I tracked down and reported the problems:
https://puszcza.gnu.org.ua/bugs/?611
Thanks in advance for taking the patch!
Comment 3 Larry the Git Cow gentoo-dev 2023-10-15 17:14:56 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0d90a39ef74113812f54e1a1b83a711cdef054d4

commit 0d90a39ef74113812f54e1a1b83a711cdef054d4
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2023-10-15 17:12:23 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2023-10-15 17:14:13 +0000

    dev-tex/tex4ht: Fix segmentation fault in tex4ht binary
    
    Update to EAPI 8.
    
    Closes: https://bugs.gentoo.org/915782
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 dev-tex/tex4ht/files/tex4ht-invalid-read.patch     |  35 ++++++
 .../tex4ht-20090611_p1038_p20210603-r1.ebuild      | 135 +++++++++++++++++++++
 2 files changed, 170 insertions(+)
Comment 4 Ulrich Müller gentoo-dev 2023-10-15 17:16:54 UTC
Thanks for reporting!