fix: UB due to pos=57, begin=58 (first char finded) infinite cycle => *chp : crash in text_editor
This commit is contained in:
parent
24675db26b
commit
b62cbc1cf3
@ -2528,7 +2528,7 @@ namespace nana{ namespace widgets
|
||||
|
||||
//The number of new lines minus one
|
||||
const auto chp_end = text.data() + (begin == text.npos ? text.size() : begin);
|
||||
for (auto chp = text.data() + (pos + 2); chp != chp_end; ++chp)
|
||||
for (auto chp = text.data() + (pos + 1); chp != chp_end; ++chp) // + 2
|
||||
if (*chp == '\n')
|
||||
lines.emplace_back(0, 0);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user