1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avdevice/xcbgrab: check xcb_query_pointer_reply_t pointer before use

Fixes CID1254668

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-12-09 01:54:51 +01:00
parent 754f4957d7
commit e86df0206f

View File

@ -106,12 +106,17 @@ static int xcbgrab_reposition(AVFormatContext *s,
xcb_get_geometry_reply_t *geo) xcb_get_geometry_reply_t *geo)
{ {
XCBGrabContext *c = s->priv_data; XCBGrabContext *c = s->priv_data;
int x = c->x, y = c->y, p_x = p->win_x, p_y = p->win_y; int x, y, p_x, p_y;
int w = c->width, h = c->height, f = c->follow_mouse; int w = c->width, h = c->height, f = c->follow_mouse;
if (!p || !geo) if (!p || !geo)
return AVERROR(EIO); return AVERROR(EIO);
x = c->x;
y = c->y;
p_x = p->win_x;
p_y = p->win_y;
if (f == FOLLOW_CENTER) { if (f == FOLLOW_CENTER) {
x = p_x - w / 2; x = p_x - w / 2;
y = p_y - h / 2; y = p_y - h / 2;