Description | We use vectored exception handling on Windows. According to a "community addition" [1] on the page documenting AddVectoredExceptionHandler, "A handler registered with AddVectoredExceptionHandler on the x86-32 and x86-64 platforms should clear the x86 "direction flag" at its beginning using the "cld" opcode. If an exception occurs while the direction flag is set, such as during a forward overlapping memmove(), the direction flag will remain on at the time the vectored handler is called. C compilers for Windows assume that the direction flag is clear at function call time, and things like inlined memset() calls will corrupt memory if the direction flag is set. Normal exception handlers with __try are not affected because the C runtime library clears the direction flag." |