Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

native crash and app can't pickup the exception #183

Closed
KarimFikani opened this issue Oct 19, 2017 · 6 comments
Closed

native crash and app can't pickup the exception #183

KarimFikani opened this issue Oct 19, 2017 · 6 comments

Comments

@KarimFikani
Copy link

KarimFikani commented Oct 19, 2017

Sometimes I get the following crash in release mode only.

The crash:
fbassert: Assert (/Users/heliosalonso/github/helios175/conceal/first-party/fbjni/native/fb/jni/Exceptions.cpp:308): ptr

F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
F DEBUG : Build fingerprint: 'samsung/gts28vewifixx/gts28vewifi:7.0/NRD90M/T713XXU2BQD3:user/release-keys'
F DEBUG : Revision: '5'
F DEBUG : ABI: 'arm'
F DEBUG : pid: 30174, tid: 30174, name: .atheer.airflow >>> com.atheer.airflow <<<
F DEBUG : signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xdeadb00c
F DEBUG : Abort message: 'Assert (/Users/heliosalonso/github/helios175/conceal/first-party/fbjni/native/fb/jni/Exceptions.cpp:308): ptr'
F DEBUG : r0 0000006d r1 00000000 r2 00000000 r3 deadb00c
F DEBUG : r4 cebe1098 r5 fff408e4 r6 fff408e0 r7 f0d09008
F DEBUG : r8 fff408e4 r9 f0705900 sl 00000000 fp fff409bc
F DEBUG : ip f30d8c74 sp fff40890 lr ceba7e6b pc ceba7e6e cpsr 600f0030
F DEBUG :
F DEBUG : backtrace:
F DEBUG : #00 pc 00009e6e /data/app/com.atheer.airflow-1/lib/arm/libfb.so (_ZN8facebook14assertInternalEPKcz+69)
F DEBUG : #1 pc 0000b6df /data/app/com.atheer.airflow-1/lib/arm/libfb.so (_ZN8facebook3jni31getJavaExceptionForCppExceptionENSt15__exception_ptr13exception_ptrE+42)
F DEBUG : #2 pc 0000b77f /data/app/com.atheer.airflow-1/lib/arm/libfb.so (_ZN8facebook3jni43translatePendingCppExceptionToJavaExceptionEv+26)
F DEBUG : #3 pc 0000dcdd /data/app/com.atheer.airflow-1/lib/arm/libconcealjni.so
F DEBUG : #4 pc 013680e5 /data/app/com.atheer.airflow-1/oat/arm/base.odex (offset 0x12f4000)

Also I use the proguard that was provided here https://github.com/facebook/conceal/blob/master/proguard_annotations.pro

The library loads fine after I enabled multiDexEnabled in app gradle.

@KarimFikani
Copy link
Author

The reason why I got this error is because one of the files that I was decrypting was already unencrypted. I did add on my side a boolean to check before decrypting if the file was encrypted. It would be nice to have an api that checks if a file was encrypted or not or send a more descriptive exception.

@idish
Copy link

idish commented Dec 11, 2017

#180 (comment)

@helios175
Copy link
Contributor

helios175 commented Jan 16, 2018

I will get into why the C++ exception is not thrown and handled by Java as it should!
The C++ exception should be thrown when it checks the header. If it doesn't start with the proper bytes (0x01 and 0x01 or 0x02 depending on key length) it will throw.

The stacktrace you posted suggest there's an "assert" problem when trying to convert the C++ exception to Java exception.

If you want, you can check if the file starts with those bytes, to manually check the format (but yes, errors should be converted to Java!!):

BufferedInputStream bis = new BufferedINputStream(cipherIS, 2); // only 2 bytes needed
bis.mark();
// verify bis.read() == 1
// verify bis.read() == CryptoConfig.KEY_128.id/CryptoConfig.KEY_128.id
bis.reset(); // go back to beginning
// now decrypt from bis

@KarimFikani
Copy link
Author

@helios175 Thank you for the response :)

@xuxya
Copy link

xuxya commented Jul 3, 2018

I had the same problem.
Google Play reports some crash log, same to this
Does it work that check before decrypting if the file was encrypted?
And what can i do to check it?
Thanks a lot.
@KarimFikani

@KarimFikani
Copy link
Author

KarimFikani commented Jul 21, 2018

@sinianxunmi Sorry for the late reply. What I did was that I kept track, in my local DB, if a file is decrypted or not. Make sure that that boolean is always updated when encrypting/decrypting the file. Hope this helps!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants