vdpau/decode: Check max width and max height.
authorRico Schüller <kgbricola@web.de>
Sat, 14 Sep 2013 18:27:07 +0000 (20:27 +0200)
committerChristian König <christian.koenig@amd.com>
Sun, 15 Sep 2013 14:18:08 +0000 (16:18 +0200)
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/vdpau/decode.c

index 47ca2294eff831cec61c8587d70192f5e00b8a29..b144b8368d78d37a3928e8d5361ce957f0c21f1e 100644 (file)
@@ -51,6 +51,7 @@ vlVdpDecoderCreate(VdpDevice device,
    vlVdpDecoder *vldecoder;
    VdpStatus ret;
    bool supported;
+   uint32_t maxwidth, maxheight;
 
    if (!decoder)
       return VDP_STATUS_INVALID_POINTER;
@@ -84,6 +85,25 @@ vlVdpDecoderCreate(VdpDevice device,
       return VDP_STATUS_INVALID_DECODER_PROFILE;
    }
 
+   maxwidth = screen->get_video_param
+   (
+      screen,
+      templat.profile,
+      PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
+      PIPE_VIDEO_CAP_MAX_WIDTH
+   );
+   maxheight = screen->get_video_param
+   (
+      screen,
+      templat.profile,
+      PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
+      PIPE_VIDEO_CAP_MAX_HEIGHT
+   );
+   if (width > maxwidth || height > maxheight) {
+      pipe_mutex_unlock(dev->mutex);
+      return VDP_STATUS_INVALID_SIZE;
+   }
+
    vldecoder = CALLOC(1,sizeof(vlVdpDecoder));
    if (!vldecoder) {
       pipe_mutex_unlock(dev->mutex);