From 4b7ff07db28ea5302a1965496d1fd71a9d99780e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 10 May 2010 11:46:25 -0700 Subject: [PATCH] Check pixmap allocation return value when creating glyphs The driver may decide that the pixmap is too large or something and fail to allocate a pixmap; not checking would lead to a segfault. Signed-off-by: Keith Packard Reviewed-by: Jamey Sharp (cherry picked from commit 87ea5760f86eb60840e6e2c10012915952df5377) --- render/render.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/render/render.c b/render/render.c index 2d9e47a9c..afe4c92e7 100644 --- a/render/render.c +++ b/render/render.c @@ -1159,6 +1159,12 @@ ProcRenderAddGlyphs (ClientPtr client) width, height, depth, CREATE_PIXMAP_USAGE_GLYPH_PICTURE); + if (!pDstPix) + { + err = BadAlloc; + goto bail; + } + GlyphPicture (glyph)[screen] = pDst = CreatePicture (0, &pDstPix->drawable, glyphSet->format, @@ -1168,6 +1174,7 @@ ProcRenderAddGlyphs (ClientPtr client) /* The picture takes a reference to the pixmap, so we drop ours. */ (pScreen->DestroyPixmap) (pDstPix); + pDstPix = NULL; if (! pDst) {