lexborisov / myhtml

Fast C/C++ HTML 5 Parser. Using threads.
GNU Lesser General Public License v2.1
1.66k stars 147 forks source link

Fix segfaults in ALL_IN_ONE mode #164

Closed Azq2 closed 4 years ago

Azq2 commented 5 years ago

Test data:

'<div>ewfewfweffefwe</div>' x 10000

Code:

myhtml = myhtml_create();
myhtml_init(myhtml, MyHTML_OPTIONS_PARSE_MODE_ALL_IN_ONE, 1, 0);

myhtml_tree_t *tree = myhtml_tree_create();
myhtml_tree_init(tree, myhtml);
myhtml_parse(tree, MyENCODING_DEFAULT, html_str, html_length);
Azq2 commented 5 years ago

from <= mythread->entries_length

Its strange. I faster check code and i think it like a bug.

I replace to from < mythread->entries_length

May be it ok for multithread/single mode... but after this PR nothing breaks.