Closed neurodroid closed 10 years ago
From christoph.schmidthieber@gmail.com on May 23, 2012 02:04:04
Rather than aborting, we could show a truncated version of the file that fits into memory. Decrypting the file to storage wouldn't make any sense since this is precisely what the "Safe preview" is trying to avoid. See SecurityConsiderations in the wiki.
Owner: christoph.schmidthieber@gmail.com
Labels: -Type-Defect Type-Enhancement
From cdho...@gmail.com on May 23, 2012 07:35:17
Then perhaps there is a middle ground, where we can have an "unsafe preview" that will extract the file to a temporary location, but then automatically delete it when "forget decryption" is pressed? Otherwise I have to go clean up the temporary files myself.
From christoph.schmidthieber@gmail.com on May 23, 2012 07:53:45
Maybe I misunderstood you:
From cdho...@gmail.com on May 23, 2012 08:33:02
The OutOfMemoryException comes when I use "Open". I have never used the "Safe text preview" option.
I would not expect an OOM exception to happen when using any kind of hard storage... if the storage is exhausted then there would be an IOException instead, yes? It seems like "Open" is still buffering in memory.
From christoph.schmidthieber@gmail.com on May 23, 2012 08:36:04
Now I get it. This is a bug then. Do you get a forced close? How large is your file?
Labels: -Type-Enhancement Type-Defect
From cdho...@gmail.com on May 23, 2012 08:48:15
I don't get a forced closed since the last two updates or so, now I get a message something like "Caught OutOfMemoryError, this file is too big to be previewed." I believe that 9a5a42ac1a056e71207cabd48759357fb4ee522b changed this from a force close to a simple error message.
I think this added call is the one that shows me the OOM exception text: showToast(getString(R.string.out_of_memory) + " (" + e.toString() + ").");
From cdho...@gmail.com on May 23, 2012 08:58:22
Oh, and the files that fail are usually in the hundreds-of-megabytes range.
From christoph.schmidthieber@gmail.com on May 23, 2012 09:01:17
Thanks, that's very helpful. It throws in L1425 of FileDialog.java: byte[] buffer = new byte[fis.available()]. The fix is to allocate a fixed number of bytes (say 1024) in a loop until the input stream is empty rather than all at once in a single allocation. Let me know if you'd like to give it a go yourself :-)
From cdho...@gmail.com on May 23, 2012 09:35:11
I would, but I don't have the Android toolchain installed at the moment. :/
From christoph.schmidthieber@gmail.com on May 23, 2012 10:43:13
This issue was closed by revision eab6b7112121 .
Status: Fixed
From christoph.schmidthieber@gmail.com on May 23, 2012 10:44:52
Please test 0.6.9 from the downloads section before I release it on Google Play: https://cryptonite.googlecode.com/files/cryptonite-BETA-0.6.9.apk
From cdho...@gmail.com on May 23, 2012 13:20:02
Yup, that fixed the issue perfectly. Thanks!
From christoph.schmidthieber@gmail.com on May 23, 2012 14:55:21
Status: FixVerified
From cdho...@gmail.com on May 23, 2012 00:11:32
When previewing a file that is too large to be held in memory, the application will abort the decryption process completely and therefore large files cannot be viewed. It would probably make more sense to decrypt the file to storage directly instead of buffering the decrypted data in memory.
Original issue: http://code.google.com/p/cryptonite/issues/detail?id=25