On Thursday 13 February 2025 14:10:44 Martin Storsjö wrote:
> On Fri, 7 Feb 2025, Pali Rohár wrote:
> 
> > This will report runtime error if _CRT_INIT(DLL_PROCESS_DETACH) is called
> > by the current thread from some atexit_table hook.
> 
> In which way will it report a runtime error? Do you mean the call to
> _amsg_exit(31), which gets called if (__native_startup_state !=
> __initialized)?

Yes.

> We only set __native_startup_state = __uninitialized; after calling
> _execute_onexit_table(&atexit_table);, so while executing atexit_table, we
> still have __native_startup_state as it was originally.
> 
> // Martin

I see. When thread which is executing atexit_table will somehow call
_CRT_INIT(DLL_PROCESS_DETACH) then it would again execute atexit_table.

So the above guard does not catch infinite loop when exit hooks calls
again detach.


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to