Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 531910 - app-text/html2text-1.3.2a - segmentation fault on architectures where int is not the same length as (char *)
Summary: app-text/html2text-1.3.2a - segmentation fault on architectures where int is ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Jaroslav Rakhmatoullin
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-12-07 17:23 UTC by Jaroslav Rakhmatoullin
Modified: 2015-04-23 07:23 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
gcc 4.7 (gcc-version,50 bytes, text/plain)
2014-12-07 17:24 UTC, Jaroslav Rakhmatoullin
Details
/tmp/bug/center.div.justified.td.htm (center.div.justified.td.htm,336 bytes, text/html)
2014-12-07 17:25 UTC, Jaroslav Rakhmatoullin
Details
[failure] =app-text/html2text-1.3.2a (failure,984 bytes, text/plain)
2014-12-07 17:26 UTC, Jaroslav Rakhmatoullin
Details
[success] =app-text/html2text-1.3.2a-r1 (success,1018 bytes, text/plain)
2014-12-07 17:27 UTC, Jaroslav Rakhmatoullin
Details
html2text-1.3.2.ebuild.patch (html2text-1.3.2.ebuild.patch,812 bytes, patch)
2014-12-07 17:28 UTC, Jaroslav Rakhmatoullin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Rakhmatoullin 2014-12-07 17:23:26 UTC
http://www.mbayer.de/html2text/issues.shtml

 The problem is in the usage of get_attribute, which is a variable argument function. The function checks for a NULL (char *) argument to terminate processing. Callers used 0 to represent the end of the list, which fails on architectures where int is not the same length as (char *). Callers should use NULL when they mean NULL.
C++ blurs the difference between 0 and NULL much more than C. In a variable argument function call, there is still a difference.

Larry Doolittle very kindly wrote a a patch that fixes this. It can be found in the program's downloads directory. 


Reproducible: Always

Steps to Reproduce:
1.emerge =app-text/html2text-1.3.2a
2.wget http://www.dayid.org/os/notes/tm.html -O /tmp/input
3.html2text < /tmp/center.div.justified.td.htm
Actual Results:  
Segmentation fault

Expected Results:  
formatted text.

Relevant for some 1990's era html-layout practices.
Comment 1 Jaroslav Rakhmatoullin 2014-12-07 17:24:18 UTC
Created attachment 391150 [details]
gcc 4.7
Comment 2 Jaroslav Rakhmatoullin 2014-12-07 17:25:47 UTC
Created attachment 391152 [details]
/tmp/bug/center.div.justified.td.htm

This input causes a segmentation fault for me.

Original document from http://www.dayid.org/os/notes/tm.html
Comment 3 Jaroslav Rakhmatoullin 2014-12-07 17:26:35 UTC
Created attachment 391154 [details]
[failure] =app-text/html2text-1.3.2a
Comment 4 Jaroslav Rakhmatoullin 2014-12-07 17:27:08 UTC
Created attachment 391156 [details]
[success] =app-text/html2text-1.3.2a-r1
Comment 5 Jaroslav Rakhmatoullin 2014-12-07 17:28:40 UTC
Created attachment 391160 [details, diff]
html2text-1.3.2.ebuild.patch

Easy fix with upstream patch.
Comment 6 Jaroslav Rakhmatoullin 2014-12-07 17:29:31 UTC
Please consider applying the submitted ebuild patch.
Comment 7 Sergey Popov gentoo-dev 2015-04-23 07:23:35 UTC
+*html2text-1.3.2a-r1 (23 Apr 2015)
+
+  23 Apr 2015; Sergey Popov <pinkbyte@gentoo.org> +html2text-1.3.2a-r1.ebuild,
+  metadata.xml:
+  Revision bump: EAPI 5, epatch_user, fix segmentation fault, wrt bug #531910.
+  Package will be maintained by Jaroslav Rakhmatoullin <jazzoslav AT gmail.com>
+  via proxy maintainers