Skip to content
This repository has been archived by the owner on Apr 23, 2019. It is now read-only.

Commit

Permalink
Fix a memory corruption to prevent segfault in VP8
Browse files Browse the repository at this point in the history
Fixed a memory corruption in psb-video. Check the value
of numAdapt before modifying the info[] in GetPortId.
Without this check it will cause a memory corruption
leading to intermittent segfaults in Chrome browser.

Change-Id: I1bae44886e9cb0deab8aa5abe5ceafa6e778350d
Signed-off-by: Sameer Kibey <[email protected]>
  • Loading branch information
skibey committed Feb 18, 2014
1 parent c12372d commit b25182a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/x11/psb_xvva.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ static int GetPortId(VADriverContextP ctx, psb_x11_output_p output)
Display *dpy = (Display *)ctx->native_dpy;

ret = XvQueryAdaptors(dpy, DefaultRootWindow(dpy), &numAdapt, &info);
/*Force overlay port num equal to one. OverlayC can't be used independently now.*/
info[1].num_ports = 1;

/* check for numAdapt before modifying the info[1]. Without this check
* it will cause a memory corruption leading to segfaults */
if (numAdapt > 1)
{
/*Force overlay port num equal to one. OverlayC can't be used independently now.*/
info[1].num_ports = 1;
}

if (Success != ret) {
drv_debug_msg(VIDEO_DEBUG_ERROR, "Can't find Xvideo adaptor\n");
Expand Down

0 comments on commit b25182a

Please sign in to comment.