Quantcast
Channel: keepass2android Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 955

Commented Unassigned: Use of PipedStreams and BitmapFactory [718]

$
0
0
It appears there is use case of KeePass2Android that passes PNG files to across Piped streams. The PipedInputStream is passed to BitmapFactory for decoding.

Because InputStreams (in general) do not explicity specify length. The PNG decoder must read() from the stream in chunks as it decodes the PNG.

There is a problem if the PNG decoder tries to read a chunk that is larger than the number of bytes available in the stream. The PipedInputStream will hang while waiting for bytes (which may never arrive).

There is a simple solution to this problem. The corresponding PipedOutputStream should be closed before calling BitmapFactory. In that case, read() will not hang, because it knows that no more bytes will arrive.

The reason that I bring up this issue is that there are changes to the PNG decoding implementation in future Android releases. These changes may cause the hanging to occur more frequently (increased risk of asking to read() more bytes than are available).

Although the original use case was never guaranteed to work, I wanted to reach out and make you aware of the behavior change.

I'm not extremely familiar with Keepass2Android, but, if it helps, I'm happy to help collaborate on a fix. Let me know what you think.
Comments: Ping :). Any inputs? This seems to be related to: https://keepass2android.codeplex.com/workitem/714 https://keepass2android.codeplex.com/workitem/713

Viewing all articles
Browse latest Browse all 955

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>