Automattic / Automattic/EncryptedLogging

Crash on class com.goterl.lazysodium.interfaces.SecretStream$State$ByReference

Open
#27 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
3
Forks
2
PR merge metrics
No merged PRs in 30d

Description

We got few crashes in WCAndroid.

```
java.lang.Error: Structure.getFieldOrder() on class com.goterl.lazysodium.interfaces.SecretStream$State$ByReference returns names ([_pad, k, nonce]) which do not match declared field names ([_pad, k])
at com.sun.jna.Structure.getFields(Structure.java:1161)
at com.sun.jna.Structure.deriveLayout(Structure.java:1340)
at com.sun.jna.Structure.calculateSize(Structure.java:1237)
at com.sun.jna.Structure.allocateMemory(Structure.java:420)
at com.sun.jna.Structure.ensureAllocated(Structure.java:396)
at com.sun.jna.Structure.ensureAllocated(Structure.java:386)
at com.sun.jna.Structure.write(Structure.java:795)
at com.sun.jna.Structure.autoWrite(Structure.java:2360)
at com.goterl.lazysodium.Sodium.crypto_secretstream_xchacha20poly1305_init_push(Sodium.java)
at com.goterl.lazysodium.LazySodium.cryptoSecretStreamInitPush(LazySodium.java:1284)
at com.automattic.encryptedlogging.model.encryptedlogging.LogEncrypter.buildHeader(LogEncrypter.kt:58)
at com.automattic.encryptedlogging.model.encryptedlogging.LogEncrypter.encrypt(LogEncrypter.kt:28)
at com.automattic.encryptedlogging.store.EncryptedLogStore.uploadEncryptedLog(EncryptedLogStore.kt:138)
at com.automattic.encryptedlogging.store.EncryptedLogStore.uploadNext(EncryptedLogStore.kt:118)
at com.automattic.encryptedlogging.store.EncryptedLogStore.access$isUploadAvailable(EncryptedLogStore.kt:33)
at com.automattic.encryptedlogging.store.EncryptedLogStore.access$uploadNext(EncryptedLogStore.kt:33)
at com.automattic.encryptedlogging.store.EncryptedLogStore$uploadNext$1.invokeSuspend(EncryptedLogStore.kt:0)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:124)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)
```

and/or...

```
java.lang.Error: Structure.getFieldOrder() on class com.goterl.lazysodium.interfaces.SecretStream$State$ByReference returns names ([_pad, k, nonce]) which do not match declared field names ([_pad, nonce])
at com.sun.jna.Structure.getFields(Structure.java:1161)
at com.sun.jna.Structure.deriveLayout(Structure.java:1340)
at com.sun.jna.Structure.calculateSize(Structure.java:1237)
at com.sun.jna.Structure.calculateSize(Structure.java:1183)
at com.sun.jna.Structure.allocateMemory(Structure.java:433)
at com.sun.jna.Structure.(Structure.java:223)
at com.sun.jna.Structure.(Structure.java:211)
at com.sun.jna.Structure.(Structure.java:198)
at com.sun.jna.Structure.(Structure.java:190)
at com.goterl.lazysodium.interfaces.SecretStream$State.(SecretStream.java:260)
at com.goterl.lazysodium.interfaces.SecretStream$State$ByReference.(SecretStream.java:262)
at com.automattic.encryptedlogging.model.encryptedlogging.LogEncrypter.encrypt(LogEncrypter.kt:27)
at com.automattic.encryptedlogging.store.EncryptedLogStore.uploadEncryptedLog(EncryptedLogStore.kt:138)
at com.automattic.encryptedlogging.store.EncryptedLogStore.uploadNext(EncryptedLogStore.kt:118)
at com.automattic.encryptedlogging.store.EncryptedLogStore.access$isUploadAvailable(EncryptedLogStore.kt:33)
at com.automattic.encryptedlogging.store.EncryptedLogStore.access$uploadNext(EncryptedLogStore.kt:33)
at com.automattic.encryptedlogging.store.EncryptedLogStore$uploadNext$1.invokeSuspend(EncryptedLogStore.kt:0)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:124)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)
```

...plus other combinations like that, ie `[_pad]`, `[k, nonce]`, versus `[_pad, k, nonce]`, although less frequent... 🤔

Reports:
- [WOOMOB-1084](https://linear.app/a8c/issue/WOOMOB-1084)

FYI: [jna 5.17.0 Incompatibility with lazysodium-java 5.2.0 #142](https://github.com/terl/lazysodium-java/issues/142)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.