System Information
Operating system: Windows 10
Graphics card: N/A
Blender Version
Broken: 3.1
Worked: 3.0.1
Short description of error
The method file_browse_exec in source\blender\editors\space_buttons\buttons_ops.c corrupts the heap when a relative directory path becomes longer than the absolute directory path.
The bug occurs between lines 210 and 213. path_len is the length of the absolute path (str), not the relative path (path) as seems to be intended.
The public release of Blender 3.1 suffers from these crashes, as do current builds of Git master.
The callstack:
ucrtbased.dll!free_dbg_nolock(void * const block, const int block_use) Line 952 C++ ucrtbased.dll!_free_dbg(void * block, int block_use) Line 1030 C++ ucrtbased.dll!free(void * block) Line 32 C++ blender.exe!MEM_lockfree_freeN(void * vmemh) Line 118 C blender.exe!file_browse_exec(bContext * C, wmOperator * op) Line 231 C blender.exe!wm_handler_fileselect_do(bContext * C, ListBase * handlers, wmEventHandler_Op * handler, int val) Line 2571 C blender.exe!wm_handler_fileselect_call(bContext * C, ListBase * handlers, wmEventHandler_Op * handler, const wmEvent * event) Line 2670 C blender.exe!wm_handlers_do_intern(bContext * C, wmWindow * win, wmEvent * event, ListBase * handlers) Line 3143 C blender.exe!wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 3199 C blender.exe!wm_event_do_handlers(bContext * C) Line 3767 C blender.exe!WM_main(bContext * C) Line 626 C blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Line 551 C
The debug assert message is:
HEAP CORRUPTION DETECTED: after Normal block (#2927924) at 0x0000014DE8153E80.
CRT detected that the application wrote to memory after end of heap buffer.
Exact steps for others to reproduce the error
- Open the file above in Blender 3.1 and execute its startup script
- Click on the file select dialog that appears in the bottom right corner of the screen (in "Custom Properties")
- Click on the gear icon in the top right of the window that opens and check the "Relative Path" option
- Select a path distant from the file, so that parent directory segments are required in the relative path (e.g. ../../../..)
- Once you click Accept, heap corruption occurs.