[Android] Thumbnailer: reject weird video files
Jean-Baptiste Kempf
git at videolan.org
Wed Dec 5 18:24:18 CET 2012
vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Dec 5 18:23:51 2012 +0100| [24636222e80c09504666b58997fd797702cc3a1c] | committer: Jean-Baptiste Kempf
Thumbnailer: reject weird video files
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=24636222e80c09504666b58997fd797702cc3a1c
---
vlc-android/jni/thumbnailer.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/vlc-android/jni/thumbnailer.c b/vlc-android/jni/thumbnailer.c
index bf505a6..4c03150 100644
--- a/vlc-android/jni/thumbnailer.c
+++ b/vlc-android/jni/thumbnailer.c
@@ -177,7 +177,7 @@ jbyteArray Java_org_videolan_vlc_LibVLC_getThumbnail(JNIEnv *env, jobject thiz,
libvlc_media_release(m);
/* Parse the results */
- unsigned videoWidth, videoHeight;
+ unsigned videoWidth = 0, videoHeight = 0;
bool hasVideoTrack = false;
for (unsigned i = 0; i < nbTracks; ++i)
if (tracks[i].i_type == libvlc_track_video)
@@ -197,6 +197,8 @@ jbyteArray Java_org_videolan_vlc_LibVLC_getThumbnail(JNIEnv *env, jobject thiz,
goto end;
}
+ LOGD("Video dimensions: %ix%i.\n", videoWidth, videoHeight );
+
/* VLC could not tell us the size */
if( videoWidth == 0 || videoHeight == 0 )
{
@@ -204,6 +206,12 @@ jbyteArray Java_org_videolan_vlc_LibVLC_getThumbnail(JNIEnv *env, jobject thiz,
goto end;
}
+ if( videoWidth < 32 || videoHeight < 32 || videoWidth > 2048 || videoWidth > 2048 )
+ {
+ LOGE("Wrong video dimensions.\n");
+ goto end;
+ }
+
/* Compute the size parameters of the frame to generate. */
unsigned thumbWidth = frameWidth;
unsigned thumbHeight = frameHeight;
More information about the Android
mailing list