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 on scanning large APKs #75

Open
erazemk opened this issue May 19, 2022 · 0 comments
Open

Crash on scanning large APKs #75

erazemk opened this issue May 19, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@erazemk
Copy link

erazemk commented May 19, 2022

When trying to scan a large APK (through the "Scan APK" feature), the app crashes with the following message:

FATAL EXCEPTION: AsyncTask #1
Process: tech.projectmatris.antimalwareapp, PID: 10842
java.lang.RuntimeException: An error occurred while executing doInBackground()
	at android.os.AsyncTask$4.done(AsyncTask.java:415)
	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
	at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
	at java.util.concurrent.FutureTask.run(FutureTask.java:271)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:920)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 1463300032 byte allocation with 25165824 free bytes and 764MB until OOM, target footprint 29321320, growth limit 805306368
	at tech.projectmatris.antimalwareapp.utils.Sha256HashExtractor.convertFileByteArray(Sha256HashExtractor.java:25)
	at tech.projectmatris.antimalwareapp.utils.Sha256HashExtractor.getSha256Hash(Sha256HashExtractor.java:18)
	at tech.projectmatris.antimalwareapp.scanners.ApkScanner.doInBackground(ApkScanner.java:132)
	at tech.projectmatris.antimalwareapp.scanners.ApkScanner.doInBackground(ApkScanner.java:37)
	at android.os.AsyncTask$3.call(AsyncTask.java:394)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	... 4 more

The APK I tried to scan is 1,46 GB large.
I'm guessing the app extracts the apk in memory and then scans it also in memory? Would it be possible to extract the application to a temporary directory and scan through that?

My device is a Poco F3 (8 GB of RAM), Android 12.

@projectmatris projectmatris added the bug Something isn't working label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants