Open NobleMathews opened 1 month ago
To address the heap-use-after-free
error in the decor_providers_invoke_win
function, follow these actionable steps:
Prevent Vector Modification During Iteration:
decor_providers
vector is not modified while iterating over it in the decor_providers_invoke_win
function.Add Validity Checks for Providers:
DecorProvider
objects are not accessed if they have been cleared or marked for deletion.void decor_providers_invoke_win(win_T *wp, DecorProviders *providers) {
decor_state.running_decor_provider = true;
for (size_t k = 0; k < kv_size(*providers); k++) {
DecorProvider *p = kv_A(*providers, k);
if (p && p->active && p->redraw_win != LUA_NOREF) {
// Ensure provider is still valid
if (!p->active) {
continue;
}
MAXSIZE_TEMP_ARRAY(args, 3);
ADD_C(args, WINDOW_OBJ(wp->handle));
ADD_C(args, BUFFER_OBJ(wp->w_buffer->handle));
ADD_C(args, INTEGER_OBJ(wp->w_cursor.lnum));
if (!decor_provider_invoke(p, "win", p->redraw_win, args, true)) {
// Mark provider as inactive if invocation fails
p->active = false;
}
}
}
decor_state.running_decor_provider = false;
}
Handle Modifications Safely:
decor_providers
vector, such as resizing, outside of iteration loops.Use a Separate List for Deferred Actions:
💡 To rerun Mayil, comment mayil-ai rerun
. Mayil will incorporate any new context added to the ticket. Include details in your rerun comment to guide Mayil!
hashtaghashtaghashtag Problem
hashtaghashtaghashtag Steps to reproduce
Only partial: only included for reference
CC=clang make CMAKE_FLAGS="-DENABLE_ASAN_UBSAN=1"
VIMRUNTIME=$(pwd)/runtime ./build/bin/nvim <FILE>
hashtaghashtaghashtag Neovim version (nvim -v)
NVIM v0.10.0-dev-693aea0e9
hashtaghashtaghashtag Operating system/version
macOS 14.1.1
hashtaghashtaghashtag Terminal name/version
wezterm
hashtaghashtaghashtag $TERM environment variable
wezterm
hashtaghashtaghashtag Installation
source