add some param check condition

This commit is contained in:
zsq
2012-04-20 09:50:43 +00:00
parent 29b5c8dc29
commit 12736aef5b

View File

@@ -323,6 +323,15 @@ static int rga_check_param(const struct rga_req *req)
}
}
if(!((req->render_mode == color_fill_mode) || (req->render_mode == line_point_drawing_mode)))
{
if (unlikely((req->src.vir_w <= 0) || (req->src.vir_w > 8191) || (req->src.vir_h <= 0) || (req->src.vir_h > 8191)))
{
ERR("invalid source resolution vir_w = %d, vir_h = %d\n", req->src.vir_w, req->src.vir_h);
return -EINVAL;
}
}
//check dst width and height
if (unlikely((req->dst.act_w <= 0) || (req->dst.act_w > 2048) || (req->dst.act_h <= 0) || (req->dst.act_h > 2048)))
{
@@ -330,6 +339,12 @@ static int rga_check_param(const struct rga_req *req)
return -EINVAL;
}
if (unlikely((req->dst.vir_w <= 0) || (req->dst.vir_w > 2048) || (req->dst.vir_h <= 0) || (req->dst.vir_h > 2048)))
{
ERR("invalid destination resolution vir_w = %d, vir_h = %d\n", req->dst.vir_w, req->dst.vir_h);
return -EINVAL;
}
//check src_vir_w
if(unlikely(req->src.vir_w < req->src.act_w)){
ERR("invalid src_vir_w act_w = %d, vir_w = %d\n", req->src.act_w, req->src.vir_w);