You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
bug: dstr_insert_ch writes one byte past the buffer when inserting mid-string #46
libobs/util/dstr.cdstr_insert_ch calls dstr_ensure_capacity(dst, ++dst->len + 1) and then memmove(dst->array + idx + 1, dst->array + idx, dst->len - idx + 1). Because it uses the already incremented len, it moves one byte too many and writes array[new_len + 1]. That is out of bounds when capacity == new_len + 1 (e.g. "ac" with capacity 4, then insert_ch(1, 'b')).
Found by the Phase 3 reviewer. test_dstr.c currently avoids the case rather than characterizing it. Fix in C (RED: an ASan cmocka test for exactly that case), and the dstr port (#43) must not reproduce it.
Activity
test(libobs): RED dstr_insert_ch overrun test (#46)
libobs/util: Keep dstr_insert_ch inside the buffer
feat(rust): Port utf8, lexer, text-lookup, dstr and bmem to obs-util (#…
feat(rust): Port utf8, lexer, text-lookup, dstr and bmem to obs-util (#…
feat(rust): Port utf8, lexer, text-lookup, dstr and bmem to obs-util (#…
feat(rust): Port utf8, lexer, text-lookup, dstr and bmem to obs-util (#…
feat(rust): Port utf8, lexer, text-lookup, dstr and bmem to obs-util (#…