Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

valgrind found many issues about uninitialised value #16

Closed
kcwu opened this issue Aug 17, 2016 · 3 comments
Closed

valgrind found many issues about uninitialised value #16

kcwu opened this issue Aug 17, 2016 · 3 comments

Comments

@kcwu
Copy link
Contributor

kcwu commented Aug 17, 2016

There are many noise in libgc. I don't know they are valid or not, so just disable GC by GC_DONT_GC=1 and ignore memory leak for now.

Minimal test case:

$ echo '<i>' | env GC_DONT_GC=1 valgrind ./w3m -T text/html -dump
(skip some lines)
==3705616== Conditional jump or move depends on uninitialised value(s)
==3705616==    at 0x4763F5: parse_tag (parsetagx.c:129)
==3705616==    by 0x42B6FA: HTMLlineproc0 (file.c:6446)
==3705616==    by 0x42DB3A: loadHTMLstream (file.c:7221)
==3705616==    by 0x42C596: loadHTMLBuffer (file.c:6755)
==3705616==    by 0x42ED37: openGeneralPagerBuffer (file.c:7776)
==3705616==    by 0x406BCC: main (main.c:926)
(skip some lines)

There is different issue for <dd>

$ echo '<dd>' | env GC_DONT_GC=1 valgrind ./w3m -T text/html -dump
==74559== Conditional jump or move depends on uninitialised value(s)
==74559==    at 0x4247D9: HTMLtagproc1 (file.c:4678)
==74559==    by 0x42B728: HTMLlineproc0 (file.c:6451)
==74559==    by 0x42DB3A: loadHTMLstream (file.c:7221)
==74559==    by 0x42C596: loadHTMLBuffer (file.c:6755)
==74559==    by 0x42ED37: openGeneralPagerBuffer (file.c:7776)
==74559==    by 0x406BCC: main (main.c:926)

If feeding w3m more complex input, there are more. For example,

$ echo "<table>0<td rowspan=0 colspan=300>a"   | env GC_DONT_GC=1 valgrind ./w3m -T text/html -dump

(just paste few examples here, the actual output is much longer)
==877622== Conditional jump or move depends on uninitialised value(s)
==877622==    at 0x443C54: check_compressible_cell (table.c:1174)
==877622==    by 0x4447EF: check_table_width (table.c:1261)
==877622==    by 0x446068: renderTable (table.c:1769)
==877622==    by 0x42B616: HTMLlineproc0 (file.c:6426)
==877622==    by 0x42D1A7: completeHTMLstream (file.c:6995)
==877622==    by 0x42DBB2: loadHTMLstream (file.c:7227)
==877622==    by 0x42C596: loadHTMLBuffer (file.c:6755)
==877622==    by 0x42ED37: openGeneralPagerBuffer (file.c:7776)
==877622==    by 0x406BCC: main (main.c:926)

==877622== Conditional jump or move depends on uninitialised value(s)
==877622==    at 0x443597: correlation_coefficient (table.c:1054)
==877622==    by 0x44375F: recalc_width (table.c:1085)
==877622==    by 0x443D0C: check_compressible_cell (table.c:1175)
==877622==    by 0x4447EF: check_table_width (table.c:1261)
==877622==    by 0x446068: renderTable (table.c:1769)
==877622==    by 0x42B616: HTMLlineproc0 (file.c:6426)
==877622==    by 0x42D1A7: completeHTMLstream (file.c:6995)
==877622==    by 0x42DBB2: loadHTMLstream (file.c:7227)
==877622==    by 0x42C596: loadHTMLBuffer (file.c:6755)
==877622==    by 0x42ED37: openGeneralPagerBuffer (file.c:7776)
==877622==    by 0x406BCC: main (main.c:926)

==877622== Conditional jump or move depends on uninitialised value(s)
==877622==    at 0x4E5DB08: sqrt (w_sqrt.c:27)
==877622==    by 0x4435B5: correlation_coefficient (table.c:1056)
==877622==    by 0x44375F: recalc_width (table.c:1085)
==877622==    by 0x443D0C: check_compressible_cell (table.c:1175)
==877622==    by 0x4447EF: check_table_width (table.c:1261)
==877622==    by 0x446068: renderTable (table.c:1769)
==877622==    by 0x42B616: HTMLlineproc0 (file.c:6426)
==877622==    by 0x42D1A7: completeHTMLstream (file.c:6995)
==877622==    by 0x42DBB2: loadHTMLstream (file.c:7227)
==877622==    by 0x42C596: loadHTMLBuffer (file.c:6755)
==877622==    by 0x42ED37: openGeneralPagerBuffer (file.c:7776)
==877622==    by 0x406BCC: main (main.c:926)

==877622== Conditional jump or move depends on uninitialised value(s)
==877622==    at 0x4437CD: recalc_width (table.c:1092)
==877622==    by 0x443D0C: check_compressible_cell (table.c:1175)
==877622==    by 0x4447EF: check_table_width (table.c:1261)
==877622==    by 0x446068: renderTable (table.c:1769)
==877622==    by 0x42B616: HTMLlineproc0 (file.c:6426)
==877622==    by 0x42D1A7: completeHTMLstream (file.c:6995)
==877622==    by 0x42DBB2: loadHTMLstream (file.c:7227)
==877622==    by 0x42C596: loadHTMLBuffer (file.c:6755)
==877622==    by 0x42ED37: openGeneralPagerBuffer (file.c:7776)
==877622==    by 0x406BCC: main (main.c:926)

found with help of afl-fuzz

@tats
Copy link
Owner

tats commented Aug 19, 2016

$ echo '<i>' | env GC_DONT_GC=1 valgrind ./w3m -T text/html -dump

Fixed.

$ echo '<dd>' | env GC_DONT_GC=1 valgrind ./w3m -T text/html -dump

Fixed.

$ echo "<table>0<td rowspan=0 colspan=300>a" | env GC_DONT_GC=1 valgrind ./w3m -T text/html -dump

Seems fixed by #19

Thank you.

@tats tats closed this as completed Aug 19, 2016
@tats
Copy link
Owner

tats commented Aug 19, 2016

Reverted at 6612318
cf. 0fba2f1#commitcomment-18703355

@tats tats reopened this Aug 19, 2016
tats added a commit that referenced this issue Aug 20, 2016
@tats
Copy link
Owner

tats commented Aug 20, 2016

Fixed again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants