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

myhtml_parse hangs on certain inputs #49

Closed
ghost opened this issue Jul 14, 2016 · 1 comment
Closed

myhtml_parse hangs on certain inputs #49

ghost opened this issue Jul 14, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 14, 2016

The following program hangs:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <myhtml/api.h>

int main(int argc, const char * argv[])
{
    char html[] = "<head>\n<html> X";

    // basic init
    myhtml_t* myhtml = myhtml_create();
    myhtml_init(myhtml, MyHTML_OPTIONS_DEFAULT, 1, 0);

    // first tree init 
    myhtml_tree_t* tree = myhtml_tree_create();
    myhtml_tree_init(tree, myhtml);

    // parse html
    myhtml_parse(tree, MyHTML_ENCODING_UTF_8, html, strlen(html));

    // release resources
    myhtml_tree_destroy(tree);
    myhtml_destroy(myhtml);

    return 0;
}

When I attach to the hanging program using gdb, it outputs:

(gdb) bt
#0  0x00007fd1189616cd in nanosleep () at ../sysdeps/unix/syscall-template.S:84
#1  0x000000000040d00c in myhtml_thread_nanosleep (tomeout=0x7ffd572e4a30) at thread.c:242
#2  0x000000000040db3e in mythread_queue_list_entry_wait_for_done (mythread=0x80c630, entry=0x8cbf10) at thread.c:624
#3  0x000000000040f371 in myhtml_tokenizer_end (tree=0x80ca90) at tokenizer.c:173
#4  0x000000000040136c in myhtml_parse (tree=0x80ca90, encoding=MyHTML_ENCODING_DEFAULT, html=0x7ffd572e4ae0 "<head>\n<html> X", 
    html_size=15) at myhtml.c:146
#5  0x0000000000400fc4 in main ()

afl

lexborisov added a commit that referenced this issue Jul 14, 2016
@lexborisov
Copy link
Owner

Fixed!
Thanks! You've found really important problem, not likely, but a major problem!

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

1 participant