Commit 24636222 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Thumbnailer: reject weird video files

parent 8f87a567
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment