Skip to content
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

Crash when using encryption (null ByteArray cast) #40

Open
DigiEggz opened this issue Jun 4, 2021 · 0 comments
Open

Crash when using encryption (null ByteArray cast) #40

DigiEggz opened this issue Jun 4, 2021 · 0 comments

Comments

@DigiEggz
Copy link

DigiEggz commented Jun 4, 2021

When setting a Zone to "Use Encryption" and attempting to connect, the client crashes.
Client code:

// SmartFox connection
var sfs:SmartFox;
...
// Event listener
sfs.addEventListener(SFSEvent.CRYPTO_INIT, onCryptoInit);
...
// Calling initCrypto to trigger "onCryptoInit" event listener
sfs.initCrypto();
...
// Login to Zone
private function onCryptoInit(evt:SFSEvent)
{
if (evt.params.success)
	sfs.send(new LoginRequest("username", "password", sfs.config.zone));
}

The problem is that using cast to convert an openfl or flash ByteArray to a crypto ByteArray results in a null value. For example, in the encrypt function in DefaultPacketEncrypter, Crypto.getCipher(ALGORITHM, cast ck.key, cast padding); causes a crash because the ck.key cast results in a null.

Called from hxcpp::__hxcpp_main
Called from ApplicationMain::main ApplicationMain.hx line 25
Called from ApplicationMain::create ApplicationMain.hx line 130
Called from lime.app.Application::exec lime/app/Application.hx line 150
Called from lime._internal.backend.native.NativeApplication::exec lime/_internal/backend/native/NativeApplication.hx line 146
Called from lime._internal.backend.native.NativeApplication::handleApplicationEvent lime/_internal/backend/native/NativeApplication.hx line 175
Called from lime.app._Event_Int_Void::dispatch lime/_internal/macros/EventMacro.hx line 91
Called from lime.system.ThreadPool::__update lime/system/ThreadPool.hx line 185
Called from lime.app._Event_Dynamic_Void::dispatch lime/_internal/macros/EventMacro.hx line 91
Called from lime._internal.backend.native.NativeHTTPRequest::multiThreadPool_onProgress lime/_internal/backend/native/NativeHTTPRequest.hx line 570
Called from lime.app.Promise_haxe_io_Bytes::complete lime/app/Promise.hx line 108
Called from lime._internal.backend.native.NativeHTTPRequest::loadText lime/_internal/backend/native/NativeHTTPRequest.hx line 349
Called from lime.app.Promise_String::complete lime/app/Promise.hx line 108
Called from lime.net._HTTPRequest_String::load lime/net/HTTPRequest.hx line 146
Called from lime.app.Promise::complete lime/app/Promise.hx line 108
Called from openfl.net.URLLoader::load openfl/net/URLLoader.hx line 318
Called from openfl.events.EventDispatcher::dispatchEvent openfl/events/EventDispatcher.hx line 246
Called from openfl.events.EventDispatcher::__dispatchEvent openfl/events/EventDispatcher.hx line 402
Called from com.smartfoxserver.v2.util.CryptoInitializer::onHttpResponse com/smartfoxserver/v2/util/CryptoInitializer.hx line 85
Called from openfl.events.EventDispatcher::dispatchEvent openfl/events/EventDispatcher.hx line 246
Called from openfl.events.EventDispatcher::__dispatchEvent openfl/events/EventDispatcher.hx line 402
Called from TitleState::onCryptoInit TitleState.hx line 298
Called from TitleState::selectLogin TitleState.hx line 280
Called from TitleState::sendLogin TitleState.hx line 226
Called from com.smartfoxserver.v2.SmartFox::send com/smartfoxserver/v2/SmartFox.hx line 1888
Error : Null Object Reference
@DigiEggz DigiEggz closed this as completed Jun 4, 2021
@DigiEggz DigiEggz reopened this Jun 5, 2021
@DigiEggz DigiEggz changed the title Crash when using encryption Crash when using encryption (null ByteArray cast) Jun 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant