[Android] Do not decode picture blobs over 500k length

Ludovic Fauvet etix at videolan.org
Fri Oct 19 12:59:46 CEST 2012


On Fri, Oct 19, 2012 at 11:26 AM, Jean-Baptiste Kempf <git at videolan.org> wrote:
> vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Oct 19 11:20:24 2012 +0200| [4d54b5b58410d7bd0ceb6034b7bd4da8456e197e] | committer: Jean-Baptiste Kempf
>
> Do not decode picture blobs over 500k length
>
>> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=4d54b5b58410d7bd0ceb6034b7bd4da8456e197e
> ---
>
>  vlc-android/src/org/videolan/vlc/DatabaseManager.java |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/vlc-android/src/org/videolan/vlc/DatabaseManager.java b/vlc-android/src/org/videolan/vlc/DatabaseManager.java
> index 65e6340..75831d1 100644
> --- a/vlc-android/src/org/videolan/vlc/DatabaseManager.java
> +++ b/vlc-android/src/org/videolan/vlc/DatabaseManager.java
> @@ -438,7 +438,7 @@ public class DatabaseManager {
>                  null, null, null);
>          if (cursor.moveToFirst()) {
>              blob = cursor.getBlob(0);
> -            if (blob != null && blob.length > 1) {
> +            if (blob != null && blob.length > 1 && blob.length < 500000) {

You should rather remove the blob. If we're not going to use it at all
what's the point of keeping it in the database?

>                  picture = BitmapFactory.decodeByteArray(blob, 0, blob.length);
>                  blob = null;
>              }

-- 
Ludovic Fauvet


More information about the Android mailing list