In text_buffer_add_text, for each code-point utf8_strlen is called, causing quadratic performance instead of linear, as well as a memory read outside the buffer for strings that are provided with an explicit length instead of null termination. The fix is simply to use the provided (or previously calculated) length.
In
text_buffer_add_text
, for each code-pointutf8_strlen
is called, causing quadratic performance instead of linear, as well as a memory read outside the buffer for strings that are provided with an explicit length instead of null termination. The fix is simply to use the provided (or previously calculated)length
.