Fix segmentations failure in error.c gumbo_caret_diagnostic_to_string#1
Merged
c1n1c merged 1 commit intoabak-press:masterfrom Dec 23, 2016
Merged
Conversation
Without this patch method find_last_newline returns value bigger than find_next_newline and in line `original_line.length = line_end - line_start;` overflow happens. Before changes newly added test failed with segmentation failure: ``` ./test-driver: line 107: 12171 Segmentation fault (core dumped) "$@" > $log_file 2>&1 ``` This slightly changed copy of code used in nokogumbo gem. [Link](https://github.com/rubys/nokogumbo/blob/8b4446847dea5c614759684ebcae4c580c47f4ad/ext/nokogumboc/nokogumbo.c#L230)
Author
|
@deniskorobicyn @Napolskih не знаю кого еще можно позвать |
Napolskih
approved these changes
Dec 16, 2016
deniskorobicyn
approved these changes
Dec 16, 2016
deniskorobicyn
left a comment
There was a problem hiding this comment.
Интересно, главное у них есть assert выше, но почему-то только на EOF, поидее это же можно до цикла сделать сразу
assert ( '\n' == *error_location);Хотя хз че за assert у них, может свой с блекджеком, короч как у тебя тоже пойдет 👍
Author
|
У меня есть подозрение, что этот ассерт никогда не выполняется, наверное добавили, когда писали, так и оставили. Плохо что на error.c вообще нету никаких тестов, он походу используется только при написании биндингов. |
c1n1c
approved these changes
Dec 23, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without this patch method find_last_newline returns value bigger than
find_next_newline and in line
original_line.length = line_end - line_start;overflow happens.
Before changes newly added test failed with segmentation failure:
This slightly changed copy of code used in nokogumbo gem.
Link
https://jira.railsc.ru/browse/SERVICES-1513
Суть такая: ошибка парсинга возникает на символе окончания строки, функция
find_last_newlineдолжна вернуть начало строки, до места ошибки, но поскольку ошибка возникает на символе переноса, то возвращается позиция за местом ошибки, что противоречит назначению функции.реквест в основной репозиторий google#371
там есть проблема, что там у основного майнтейнера отобрали права, а больше никто этой либой из гугла похоже не занимается google#370 (comment)