Repository navigation
fix: crashes found by running every menu command - #2
Merged
Merged
Conversation
libanalyse writes cipher results with ofstream and cracklib opens its dictionary with fopen, both on paths CrypTool passes in Windows form. They were built without mfcwx, so files landed under names like "\var\folders\...\cry6.txt" in the working directory and the next read crashed on a NULL FILE* (Caesar encryption, among others). Both libraries are now compiled with mfcwx's fopen/fstream; their unit tests link stubs. Also adds MFCWX_AUTOMATION, a small script runner (menu commands, dialog buttons, control text, waits, snapshots) for reproducing UI flows.
The brute-force analysis dialogs run in AfxBeginThread workers. Their control members were destroyed there, but ~CWnd only detached from the wx window on the main thread, so the deferred wx deletion sent WM_DESTROY to freed objects. The detach now always runs on the main thread. CWnd::SetFocus also tolerates a NULL wrapper like a NULL HWND (hybrid encryption demo).
CrypTool sizes buffers for RAND_MAX 32767 (the PKCS #5 dialog writes two rand() values into char[20] and overflowed with glibc/macOS RAND_MAX). rand/srand now use the MSVC LCG and RAND_MAX 0x7fff, which also reproduces the Windows random sequences; MIRACL's rand overloads are forwarded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every menu command of the text-document and main menus (191 commands) was run in a fresh process with the new
MFCWX_AUTOMATIONscript runner, started from/like Finder does. Before this PR 18 of them crashed; now all 191 open and close without crashing or hanging.ofstream) and cracklib (fopen) received CrypTool's Windows-style paths without conversion, so the result file was created under a literal name like\var\folders\...\cry6.txt(or not at all from Finder) and the next read crashed on aNULLFILE*. Both libraries are now compiled with mfcwx'sfopen/fstream; their unit tests link plain stubs.AfxBeginThreadworker; its control wrappers were destroyed there, but~CWndonly detached from the wx window on the main thread, so the deferred wx deletion sentWM_DESTROYto freed objects.CWnd::SetFocuson aNULLwrapper (focus saved while the app was not active) now behaves like aNULLHWND.rand()values are formatted intochar[20], sized for MSVC'sRAND_MAXof 32767. The app now gets the Microsoft C runtime'srand/srand(same LCG,RAND_MAX0x7fff), which also reproduces the Windows random sequences.Not crashes, but still open (separate follow-ups): about 90 commands open no visible window in the automated run. Most are toggles, editing commands or native file dialogs; the rest include the Java (ANIMAL) and Flash animations and the external Windows tools.