1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-15 23:35:34 +00:00
elinks/test
Kalle Olavi Niemitalo a2404407ce Fix double-free crash if EOF immediately follows </MAP>.
look_for_link() used to return 0 both when it found the closing </MAP>
tag, and when it hit the end of the file.  In the first case, it also
added *menu to the memory_list; in the second case, it did not.  The
caller get_image_map() supposedly distinguished between these cases by
checking whether pos >= eof, and freed *menu separately if so.

However, if the </MAP> was at the very end of the HTML file, so that
not even a newline followed it, then look_for_link() left pos == eof
even though it had found the </MAP> and added *menu to the memory_list.
This made get_image_map() misinterpret the result and mem_free(*menu)
even though *menu had already been freed as part of the memory_list;
thus the crash.

To fix this, make look_for_link() return -1 instead of 0 if it hits
EOF without finding the </MAP>.  Then make get_image_map() check the
return value instead of comparing pos to eof.  And add a test case,
although not an automated one.

Alternatively, look_for_link() could have been changed to decrement
pos between finding the </MAP> and returning 0.  Then, the pos >= eof
comparison in get_image_map() would have been false.  That scheme
would however have been a bit more difficult to understand and
maintain, I think.

Reported by Paul B. Mahol.
2008-12-31 20:06:49 +00:00
..
cgi test, CGI: added a simple form to test CGI. 2007-07-02 22:50:33 +03:00
css Remove unclearly licensed test files. 2008-10-03 10:56:05 +03:00
ecmascript SMJS: Fix error "forms.namedItem is not a function". 2007-07-02 22:49:09 +03:00
rss Add an RSS test file 2005-12-30 22:18:22 +01:00
xbel Add basic stuff for XBEL parsing/highlighting using the DOM engine 2005-12-30 22:19:32 +01:00
backspaces.txt Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
bigtextarea.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
color.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
comments.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
garbage.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
GFDL-1.2 test/optgroup.html is under GNU Free Documentation License 2008-09-28 22:00:35 +03:00
href_tests.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
imgmap.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
imgmap2.html Fix double-free crash if EOF immediately follows </MAP>. 2008-12-31 20:06:49 +00:00
libtest.sh Check if the test 'trash' directory could be entered 2006-01-10 15:48:33 +01:00
longtitle.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
malicious_uris.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
optgroup.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
portlink.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
README test/optgroup.html is under GNU Free Documentation License 2008-09-28 22:00:35 +03:00
refresh.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
subsup.html More sub/sup tests. 2005-10-19 23:05:41 +02:00
tabindex.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
tablebg.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
tables.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
target_blank.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
td-width.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
underline.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
xmp.html Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00

This directory contains various weird documents for testing whether we're
parsing and rendering them properly. Frequently, documents are getting added
here when we implement feature needed for their correct presentation or fix bug
occuring inside of these documents. No automated testsuite yet, though.

Possible meaningful content of the documents is completely irrelevant and you
should ignore it. Noone takes any responsibility for it :).

optgroup.html originates from <http://iccl.fi/>.  Ari Sovijärvi kindly
granted us the "GNU free documentation licence" (included in the file
GFDL-1.2).