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

heap out of bound write due to negative array index #12

Closed
kcwu opened this issue Aug 16, 2016 · 1 comment
Closed

heap out of bound write due to negative array index #12

kcwu opened this issue Aug 16, 2016 · 1 comment

Comments

@kcwu
Copy link
Contributor

kcwu commented Aug 16, 2016

How to reproduce:

$ echo -e '<table><b<>\x00<listing><select_int selectnumber=90000000000>' | ./w3m -T text/html -dump > /dev/null
Segmentation fault
$ echo -e '<table><b<>\x00<listing><select_int selectnumber=-90000>' | ./w3m -T text/html -dump > /dev/null
Segmentation fault

Here, selectnumber could be negative, or positive but overflows to negative.

The corresponding code snippet:

6033    if (parsedtag_get_value(tag, ATTR_SELECTNUMBER, &n_select)
6034        && n_select < max_select) {
6035        select_option[n_select].first = NULL;

n_select is the selectnumber mentioned above. It will crash at line 6035.

Similar code pattern at line 6015:

                      if (parsedtag_get_value(tag, ATTR_TEXTAREANUMBER,
                                              &n_textarea)
                          && n_textarea < max_textarea) {
                          textarea_str[n_textarea] = Strnew();

this is found by afl-fuzz

@tats
Copy link
Owner

tats commented Aug 18, 2016

Fixed, thank you.

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