-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AES_encrypt crash #31
Comments
@0xABC Little late to the party, but did you (or anyone else) ever find a resolution to this crash? |
@wtmoose unfortunately nope |
I'm not a C++ guy, but I believe the issue is that the struct MKCryptStatePrivate {
CryptState cs;
}; It seems they're relying on the no argument initializer being invoked implicitly. But it isn't ever called. I added this line in _priv->cs = CryptState(); Would be interested to hear from a C++ person if this change isn't necessary. |
That shouldn't be necessary because |
No, I believe @wtmoose's analysis is correct. The struct is malloc'd, and I never initialize CryptState properly. Oops. |
I did verify in the debugger that it isn't initislized without my change. |
ISTM that the easiest/cleanest fix is to replace the MKCryptStatePriv struct in MKCryptState with a pointer to CryptState instead. Then new & delete it in init/dealloc. PRs welcome. Otherwise I'll fix it soon. |
Previously, the constructor of CryptState was not called because CryptState was a member of MKCryptStatePriv, which was allocated via malloc. This gets rid of MKCryptStatePriv, and instead just keeps a pointer to the private CryptState implementation directly in MKCryptState. As a result, we now allocate a new CryptState via 'new' in init, and clean it up in dealloc via 'delete'. Fixes mumble-voip#31
@wtmoose Even if CryptState is not properly initialized, it should not trigger a crash. The memory is there, and the underlying data will be initialized when connecting to a server: when the server sends the CryptState message, everything (except decrypt_state) will be initialized. So while I agree that CryptState not being properly initialized is a bug, I am not convinced that it really fixes the issue. I know this is a hard-to-reproduce problem (at least, it has been for me), but are you sure it really fixes the crash? |
Anyway, feel free to test PR #54 to see if it helps! Thanks. |
No, I'm not sure. I made two changes at the same time and haven't had time to test them independently. The second change is related to #55. We were initially calling |
Our app has crashed a number of times with this stack trace:
I believe it is triggered by a poor internet connection but haven't been able to reproduce. Any insights appreciated.
The text was updated successfully, but these errors were encountered: