Skip to content

Commit

Permalink
msm: vidc: Validate userspace buffer count before using it
Browse files Browse the repository at this point in the history
Validate the number of buffers count variable before
using it to avoid structure overflow error.

Change-Id: I61582c93e0f26ec6842e437134fb8a42bdbc36ff
CRs-fixed: 563654
Signed-off-by: Pachika, Vikas Reddy <vpachi@codeaurora.org>
  • Loading branch information
Pachika, Vikas Reddy authored and hyperb1iss committed Nov 17, 2013
1 parent 03c8707 commit 38526b8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/video/msm/vidc/common/dec/vdec.c
Expand Up @@ -948,6 +948,12 @@ static u32 vid_dec_set_meta_buffers(struct video_client_ctx *client_ctx,
vcd_meta_buffer->offset = meta_buffers->offset;
vcd_meta_buffer->pmem_fd_iommu = meta_buffers->pmem_fd_iommu;

if (meta_buffers->count > MAX_META_BUFFERS) {
ERR("meta buffers maximum count reached, count = %d",
meta_buffers->count);
return false;
}

if (!vcd_get_ion_status()) {
if (get_pmem_file(vcd_meta_buffer->pmem_fd,
(unsigned long *) (&(vcd_meta_buffer->
Expand Down

0 comments on commit 38526b8

Please sign in to comment.