-
Notifications
You must be signed in to change notification settings - Fork 147
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
Problem with \r #91
Comments
Fixed! Please, try to test this. |
Thanks for the quick fix. |
You're welcome! |
Sure: http://www.romedic.ro/forum/intarzierea-menstruatiei-6857 (before the text "Ceea ce aveti..." there is a br, and before the br there is a \r). |
Thanks! |
and you can: size_t length;
const char* txt = myhtml_node_text(root, &length);
std::cout << "length: " << length << std::endl;
return; |
When a text node terminates with \r there is some non-deterministic behaviour (sometimes random characters in the text).
When I compile the above program with the clang memory sanitizer I get a warning about an uninitialized variable at the location where I do
strlen()
.I think it's somehow related to the following part of the code:
myhtml/source/myhtml/mystring.c
Line 238 in 371b307
Temporarily removing lines 238 and 239 avoids the sanitizer warning, but I don't dare to do a pull request right now because I don't fully understand the intention of the code. My guess is that it tries to replace \r\n by \n, and it mistakenly increments the pointer when the string ends in \r.
The text was updated successfully, but these errors were encountered: