Skip to content

Commit 631df3e

Browse files
committed
Merge #17916: windows: Enable heap terminate-on-corruption
3d5d7aa windows: remove call to SetProcessDEPPolicy (fanquake) f2645c2 windows: Enable heap terminate-on-corruption (fanquake) Pull request description: This PR is currently two separate changes: #### Enable heap terminate-on-corruption This is default behavior from Windows 8 onwards, however we still support Windows 7, so it should make sense to explicitly enable this. This is also done by projects like tor, chromium etc. > Enables the terminate-on-corruption feature. If the heap manager detects an error in any heap used by the process, it calls the Windows Error Reporting service and terminates the process. After a process enables this feature, it cannot be disabled. More info [here](https://docs.microsoft.com/en-us/windows/win32/api/heapapi/nf-heapapi-heapsetinformation). #### Remove call to SetProcessDEPPolicy() DEP is always enabled on 64-bit Windows processes, and `SetProcessDEPPolicy()` only works when called from a 32-bit process. I've tested that our current usage always fails ([as expected](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setprocessdeppolicy#remarks)) with [ERROR_NOT_SUPPORTED](https://github.com/mirror/mingw-w64/blob/16151c441e89081fd398270bb888511ebef6fb35/mingw-w64-headers/include/error.h#L42). Please don't add a "Needs gitian build" tag here yet. ACKs for top commit: sipsorcery: ACK 3d5d7aa. laanwj: ACK 3d5d7aa Tree-SHA512: 0948bcf165685b6b573f2cd950680c34356b856690de655ced2b93d497e02e7b22aa195c99f6ce33202f182622c67302ff31c98ab51b7d050574af3debdee5ce
2 parents daae640 + 3d5d7aa commit 631df3e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,8 +877,8 @@ bool AppInitBasicSetup()
877877
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
878878
#endif
879879
#ifdef WIN32
880-
// Enable Data Execution Prevention (DEP)
881-
SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
880+
// Enable heap terminate-on-corruption
881+
HeapSetInformation(nullptr, HeapEnableTerminationOnCorruption, nullptr, 0);
882882
#endif
883883

884884
if (!SetupNetworking())

0 commit comments

Comments
 (0)