[PATCH] glamor/glyphs: Fix rendering regressions
commit b0d2e010316d710eb4052963de3a1e2dc7ba356e Author: Keith Packard kei...@keithp.com Date: Fri Oct 10 09:25:51 2014 +0200 glamor: Replace CompositeGlyphs code [v2] introduced a number of regressions in both ignoring the effect of applying the user requested mask on the glyphs (for example to correctly render overlapping glyphs and to apply quantisation effects, e.g. mixing different filters) along with incorrectly computing the glyph source coordinates. Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk Cc: Keith Packard kei...@keithp.com --- glamor/glamor_composite_glyphs.c | 130 --- 1 file changed, 122 insertions(+), 8 deletions(-) diff --git a/glamor/glamor_composite_glyphs.c b/glamor/glamor_composite_glyphs.c index 39ed854..3a21eed 100644 --- a/glamor/glamor_composite_glyphs.c +++ b/glamor/glamor_composite_glyphs.c @@ -316,6 +316,54 @@ glamor_atlas_for_glyph(glamor_screen_private *glamor_priv, DrawablePtr drawable) return glamor_priv-glyph_atlas_a; } +static void +GlyphExtents(int nlist, GlyphListPtr list, GlyphPtr * glyphs, BoxPtr extents) +{ +int x1, x2, y1, y2; +int n; +GlyphPtr glyph; +int x, y; + +x = 0; +y = 0; +extents-x1 = MAXSHORT; +extents-x2 = MINSHORT; +extents-y1 = MAXSHORT; +extents-y2 = MINSHORT; +while (nlist--) { +x += list-xOff; +y += list-yOff; +n = list-len; +list++; +while (n--) { +glyph = *glyphs++; +x1 = x - glyph-info.x; +if (x1 MINSHORT) +x1 = MINSHORT; +y1 = y - glyph-info.y; +if (y1 MINSHORT) +y1 = MINSHORT; +x2 = x1 + glyph-info.width; +if (x2 MAXSHORT) +x2 = MAXSHORT; +y2 = y1 + glyph-info.height; +if (y2 MAXSHORT) +y2 = MAXSHORT; +if (x1 extents-x1) +extents-x1 = x1; +if (x2 extents-x2) +extents-x2 = x2; +if (y1 extents-y1) +extents-y1 = y1; +if (y2 extents-y2) +extents-y2 = y2; +x += glyph-info.xOff; +y += glyph-info.yOff; +} +} +} + +#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 PICT_FORMAT_RGB(f) != 0) void glamor_composite_glyphs(CARD8 op, PicturePtr src, @@ -329,6 +377,8 @@ glamor_composite_glyphs(CARD8 op, GLshort *v = NULL; DrawablePtr drawable = dst-pDrawable; ScreenPtr screen = drawable-pScreen; +PicturePtr mask = NULL; +PicturePtr glyph_dst, glyph_src; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_program *prog = NULL; PicturePtr glyph_pict = NULL; @@ -341,6 +391,57 @@ glamor_composite_glyphs(CARD8 op, int glyph_max_dim = glamor_priv-glyph_max_dim; int nglyph = 0; int screen_num = screen-myNum; +CARD32 glyph_op; +BoxRec extents; + +if (glyph_format) { + xRenderColor white = { 0x, 0x, 0x, 0x }; + CARD32 component_alpha; + PixmapPtr pixmap; + int error; + + GlyphExtents(nlist, list, glyphs, extents); + pixmap = screen-CreatePixmap(screen, + extents.x2 - extents.x1, + extents.y2 - extents.y1, + glyph_format-depth, + CREATE_PIXMAP_USAGE_SCRATCH); + if (!pixmap) + return; + + component_alpha = NeedsComponent(glyph_format-format); + mask = CreatePicture(0, pixmap-drawable, +glyph_format, +CPComponentAlpha, component_alpha, +serverClient, error); + screen-DestroyPixmap(pixmap); + if (!mask) + return; + + glyph_src = CreateSolidPicture(0, white, error); + + ValidatePicture(glyph_src); + ValidatePicture(mask); + + glamor_composite(PictOpClear, glyph_src, NULL, mask, +0, 0, +0, 0, +0, 0, +extents.x2 - extents.x1, +extents.y2 - extents.y1); + + glyph_dst = mask; + x += -extents.x1; + y += -extents.y1; + glyph_op = PictOpAdd; +} else { + glyph_dst = dst; + glyph_src = src; + glyph_op = op; +} + +x_src += list-xOff; +y_src += list-yOff; for (n = 0; n nlist; n++) nglyph += list[n].len; @@ -373,12 +474,13 @@ glamor_composite_glyphs(CARD8 op, (glyph_pix_priv != 0 glyph_pix_priv-type != GLAMOR_MEMORY))) { if (glyphs_queued)
Re: [PATCH] composite: Install SourceValidation hooks only when required
On Mon, May 18, 2015 at 03:26:29PM +0100, Chris Wilson wrote: Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk Eek, used send-email from the wrong branch. This is fun but incomplete... -Chris -- Chris Wilson, Intel Open Source Technology Centre ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH] composite: Install SourceValidation hooks only when required
Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk --- composite/compalloc.c | 3 +++ composite/compinit.c | 49 +++-- composite/compint.h| 4 composite/compwindow.c | 8 4 files changed, 46 insertions(+), 18 deletions(-) diff --git a/composite/compalloc.c b/composite/compalloc.c index 8daded0..c3973e9 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -75,6 +75,8 @@ compReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure) CompScreenPtr cs = GetCompScreen(pScreen); CompWindowPtr cw = GetCompWindow(pWin); +compMarkDamaged(pScreen); + if (!cs-BlockHandler) { cs-BlockHandler = pScreen-BlockHandler; pScreen-BlockHandler = compBlockHandler; @@ -86,6 +88,7 @@ compReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure) while (pWin) { if (pWin-damagedDescendants) break; + cs-anyDamaged++; pWin-damagedDescendants = TRUE; pWin = pWin-parent; } diff --git a/composite/compinit.c b/composite/compinit.c index 3ac075a..988bc58 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -77,9 +77,7 @@ compCloseScreen(ScreenPtr pScreen) pScreen-CopyWindow = cs-CopyWindow; pScreen-PositionWindow = cs-PositionWindow; -pScreen-GetImage = cs-GetImage; -pScreen-GetSpans = cs-GetSpans; -pScreen-SourceValidate = cs-SourceValidate; +assert(!cs-anyDamaged); free(cs); dixSetPrivate(pScreen-devPrivates, CompScreenPrivateKey, NULL); @@ -147,8 +145,11 @@ compGetImage(DrawablePtr pDrawable, if (pDrawable-type == DRAWABLE_WINDOW) compPaintChildrenToWindow((WindowPtr) pDrawable); (*pScreen-GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); -cs-GetImage = pScreen-GetImage; -pScreen-GetImage = compGetImage; + +if (cs-anyDamaged) { + cs-GetImage = pScreen-GetImage; + pScreen-GetImage = compGetImage; +} } static void @@ -162,8 +163,11 @@ compGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, if (pDrawable-type == DRAWABLE_WINDOW) compPaintChildrenToWindow((WindowPtr) pDrawable); (*pScreen-GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); -cs-GetSpans = pScreen-GetSpans; -pScreen-GetSpans = compGetSpans; + +if (cs-anyDamaged) { + cs-GetSpans = pScreen-GetSpans; + pScreen-GetSpans = compGetSpans; +} } static void @@ -180,8 +184,26 @@ compSourceValidate(DrawablePtr pDrawable, if (pScreen-SourceValidate) (*pScreen-SourceValidate) (pDrawable, x, y, width, height, subWindowMode); -cs-SourceValidate = pScreen-SourceValidate; -pScreen-SourceValidate = compSourceValidate; +if (cs-anyDamaged) { + cs-SourceValidate = pScreen-SourceValidate; + pScreen-SourceValidate = compSourceValidate; +} +} + +void compMarkDamaged(ScreenPtr pScreen) +{ +CompScreenPtr cs = GetCompScreen(pScreen); + +if (cs-anyDamaged == 0) { + cs-GetImage = pScreen-GetImage; + pScreen-GetImage = compGetImage; + + cs-GetSpans = pScreen-GetSpans; + pScreen-GetSpans = compGetSpans; + + cs-SourceValidate = pScreen-SourceValidate; + pScreen-SourceValidate = compSourceValidate; +} } /* @@ -445,15 +467,6 @@ compScreenInit(ScreenPtr pScreen) cs-CloseScreen = pScreen-CloseScreen; pScreen-CloseScreen = compCloseScreen; -cs-GetImage = pScreen-GetImage; -pScreen-GetImage = compGetImage; - -cs-GetSpans = pScreen-GetSpans; -pScreen-GetSpans = compGetSpans; - -cs-SourceValidate = pScreen-SourceValidate; -pScreen-SourceValidate = compSourceValidate; - dixSetPrivate(pScreen-devPrivates, CompScreenPrivateKey, cs); RegisterRealChildHeadProc(CompositeRealChildHead); diff --git a/composite/compint.h b/composite/compint.h index 09241f2..e6b046d 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -167,6 +167,7 @@ typedef struct _CompScreen { Window overlayWid; CompOverlayClientPtr pOverlayClients; +int anyDamaged; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; SourceValidateProcPtr SourceValidate; @@ -243,6 +244,9 @@ compReallocPixmap(WindowPtr pWin, int x, int y, Bool compScreenInit(ScreenPtr pScreen); +void + compMarkDamaged(ScreenPtr pScreen); + /* * compoverlay.c */ diff --git a/composite/compwindow.c b/composite/compwindow.c index 6eacbae..81f2a93 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -732,6 +732,13 @@ compPaintWindowToParent(WindowPtr pWin) } } +static void compClearDamaged(WindowPtr pWin) +{ +ScreenPtr pScreen = pWin-drawable.pScreen; +CompScreenPtr cs = GetCompScreen(pScreen); +cs-anyDamaged--; +} + void compPaintChildrenToWindow(WindowPtr pWin) { @@ -743,6 +750,7 @@ compPaintChildrenToWindow(WindowPtr pWin) for
[PATCH libX11] Add missing NULL checks to ICWrap
ICWrap.c dereferences the xim parameter passed in from client code without a NULL check. I have seen mplayer trigger this resulting in a segfault. In this case mplayer had called XOpenIM and NULL was returned which was later passed into XCreateIC. Patch originally by Drew Moseley drew_mose...@mentor.com. Signed-off-by: Ross Burton ross.bur...@intel.com --- src/xlibi18n/ICWrap.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/xlibi18n/ICWrap.c b/src/xlibi18n/ICWrap.c index 8c1b4a0..69f080d 100644 --- a/src/xlibi18n/ICWrap.c +++ b/src/xlibi18n/ICWrap.c @@ -169,7 +169,7 @@ XSetIMValues(XIM im, ...) va_list var; int total_count; XIMArg *args; -char *ret; +char *ret = NULL; /* * so count the stuff dangling here @@ -185,7 +185,8 @@ XSetIMValues(XIM im, ...) _XIMVaToNestedList(var, total_count, args); va_end(var); -ret = (*im-methods-set_values) (im, args); +if (im im-methods) + ret = (*im-methods-set_values) (im, args); Xfree(args); return ret; } @@ -196,7 +197,7 @@ XGetIMValues(XIM im, ...) va_list var; int total_count; XIMArg *args; -char *ret; +char *ret = NULL; /* * so count the stuff dangling here @@ -212,7 +213,8 @@ XGetIMValues(XIM im, ...) _XIMVaToNestedList(var, total_count, args); va_end(var); -ret = (*im-methods-get_values) (im, args); +if (im im-methods) + ret = (*im-methods-get_values) (im, args); Xfree(args); return ret; } @@ -228,7 +230,7 @@ XCreateIC(XIM im, ...) va_list var; int total_count; XIMArg *args; -XIC ic; +XIC ic = NULL; /* * so count the stuff dangling here @@ -244,7 +246,8 @@ XCreateIC(XIM im, ...) _XIMVaToNestedList(var, total_count, args); va_end(var); -ic = (XIC) (*im-methods-create_ic) (im, args); +if (im im-methods) + ic = (XIC) (*im-methods-create_ic) (im, args); Xfree(args); if (ic) { ic-core.next = im-core.ic_chain; -- 2.1.4 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH libXt] Fix builds on X32
From: Ross Burton ross.bur...@intel.com Date: Mon, 18 May 2015 17:05:46 +0100 The x86 X32 ABI is a 32-bit environment on 64-bit processors, so __amd64__ is defined but pointers and longs are 32-bit. Handle this case by also checking __LP64__. That's the wrong way to handle it. Not all 64-bit amd64 systems define __LP64__. Take a look at x11proto/Xmd.h. It checks __ILP32__ to decide between x32 and a proper amd64 system. Cheers, Mark Signed-off-by: Ross Burton ross.bur...@intel.com --- include/X11/Xtos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/X11/Xtos.h b/include/X11/Xtos.h index 64b2da8..44f52c2 100644 --- a/include/X11/Xtos.h +++ b/include/X11/Xtos.h @@ -59,7 +59,7 @@ SOFTWARE. defined(__sparc64__) || \ defined(__s390x__) || \ (defined(__hppa__) defined(__LP64__)) || \ -defined(__amd64__) || defined(amd64) || \ +((defined(__amd64__) || defined(amd64)) defined(__LP64__)) || \ defined(__powerpc64__) || \ (defined(sgi) (_MIPS_SZLONG == 64)) #define LONG64 -- 2.1.4 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH libXrender] Fix documentation to explicitly mention premultiplied alpha
Before this patch, it wasn't mentioned in this file at all, which is a monumental oversight. Signed-off-by: Lauri Kasanen c...@gmx.com --- v2 with gradient wording. doc/libXrender.txt | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/libXrender.txt b/doc/libXrender.txt index 27cc75d..753ee98 100644 --- a/doc/libXrender.txt +++ b/doc/libXrender.txt @@ -84,7 +84,8 @@ as a separate argument which marks the valid entries. 2.4 Colors The core protocol XColor type doesn't include an alpha component, so Xrender -has a separate type. +has a separate type. Note that XRender expects premultiplied alpha in all +cases except with the gradient operations. typedef struct { unsigned short red; @@ -526,6 +527,8 @@ conceptually built. 7.1 Composite XRenderComposite exposes the RenderComposite protocol request directly. +If a format with alpha is used, make sure it is premultiplied into the +color channels. void XRenderComposite (Display *dpy, -- 1.8.3.1 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH libXt] Fix builds on X32
The x86 X32 ABI is a 32-bit environment on 64-bit processors, so __amd64__ is defined but pointers and longs are 32-bit. Handle this case by also checking __LP64__. Signed-off-by: Ross Burton ross.bur...@intel.com --- include/X11/Xtos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/X11/Xtos.h b/include/X11/Xtos.h index 64b2da8..44f52c2 100644 --- a/include/X11/Xtos.h +++ b/include/X11/Xtos.h @@ -59,7 +59,7 @@ SOFTWARE. defined(__sparc64__) || \ defined(__s390x__) || \ (defined(__hppa__) defined(__LP64__)) || \ -defined(__amd64__) || defined(amd64) || \ +((defined(__amd64__) || defined(amd64)) defined(__LP64__)) || \ defined(__powerpc64__) || \ (defined(sgi) (_MIPS_SZLONG == 64)) #define LONG64 -- 2.1.4 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH libXt] Fix builds on X32
__LP64__ is not universally defined on all platforms (Solaris for instance uses _LP64). Last time this came up, the compromise between not breaking existing platforms and letting people who don't understand API's ABI's make up a new one was to check for ILP32: http://thread.gmane.org/gmane.comp.freedesktop.xorg.devel/27443/ which resulted in: http://cgit.freedesktop.org/xorg/proto/x11proto/commit/Xmd.h?id=a06fa7fc98b66652df8bbc4734b5010d43744373 -alan- On 05/18/15 09:05 AM, Ross Burton wrote: The x86 X32 ABI is a 32-bit environment on 64-bit processors, so __amd64__ is defined but pointers and longs are 32-bit. Handle this case by also checking __LP64__. Signed-off-by: Ross Burton ross.bur...@intel.com --- include/X11/Xtos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/X11/Xtos.h b/include/X11/Xtos.h index 64b2da8..44f52c2 100644 --- a/include/X11/Xtos.h +++ b/include/X11/Xtos.h @@ -59,7 +59,7 @@ SOFTWARE. defined(__sparc64__) || \ defined(__s390x__) || \ (defined(__hppa__) defined(__LP64__)) || \ -defined(__amd64__) || defined(amd64) || \ +((defined(__amd64__) || defined(amd64)) defined(__LP64__)) || \ defined(__powerpc64__) || \ (defined(sgi) (_MIPS_SZLONG == 64)) #define LONG64 -- -Alan Coopersmith- alan.coopersm...@oracle.com Oracle Solaris Engineering - http://blogs.oracle.com/alanc ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 2/2] Revert Revert glx/dri2: Disable AIGLX if indirect GLX is disabled
On Fri, 2015-05-15 at 13:21 -0400, Adam Jackson wrote: The previous fix to enable GLX extensions in the swrast path means that now we'll get GLX_ARB_create_context and friends enabled (assuming you have a swrast driver installed, which you ought to). This reverts commit bf6344e1913a5d24c2d68eaca999ea3d71e1b707. Signed-off-by: Adam Jackson a...@redhat.com Ignore this one. As Eric rightly pointed out on IRC, visual setup varies based on which 3d driver we load, so while this might make gles work it wouldn't give you the same set of multisample configs. - ajax ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH v2 2/2] systemd-logind: Only use systemd-logind integration together with keeptty
On 05/16/2015 01:03 AM, Hans de Goede wrote: Hi, On 15-05-15 22:21, Aaron Plattner wrote: On 04/30/2015 05:24 AM, Hans de Goede wrote: systemd-logind integration does not work when starting X on a new tty, as that detaches X from the current session and after hat systemd-logind revokes all rights any already open fds and refuses to open new fds for X. This means that currently e.g. startx -- vt7 breaks, and breaks badly, requiring ssh access to the system to kill X. The fix for this is easy, we must not use systemd-logind integration when not using KeepTty, or iow we may only use systemd-logind integration together with KeepTty. Signed-off-by: Hans de Goede hdego...@redhat.com I can confirm that this fixes VT switching for X servers started from an SSH session on Arch Linux, which I use all the time for debugging. So Tested-by: Aaron Plattner aplatt...@nvidia.com Thanks, note that testing in Fedora has found a minor issue when running headless (with the dummy driver), so a v3 of the patch-set is coming up, see: https://bugzilla.redhat.com/show_bug.cgi?id=1203780#c8 I'm waiting from feedback from the reporter before posting v3. In the mean time you can grab v3 of the patch-set here: http://cgit.freedesktop.org/~jwrdegoede/xserver/ (it is now 3 patches). Thanks! I can confirm that merging commit d7855745890d42ed56ceb97857081e9097acec12 also fixes the problem for me, so you can feel free to add my Tested-by line to those as well. -- Aaron ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH libX11 1/2] Fix potential memory leak
On 05/17/15 03:54 PM, Peter Hutterer wrote: If we hit the depth limit, filename leaks. Move the depth check up before we allocate filename. Introduced in 226622349a4b1e16064649da34fb4be4f464. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- modules/im/ximcp/imLcPrs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/im/ximcp/imLcPrs.c b/modules/im/ximcp/imLcPrs.c index 9bb45ff..4979975 100644 --- a/modules/im/ximcp/imLcPrs.c +++ b/modules/im/ximcp/imLcPrs.c @@ -496,10 +496,10 @@ parseline( token = nexttoken(fp, tokenbuf, lastch); if (token != KEY token != STRING) goto error; -if ((filename = TransFileName(im, tokenbuf)) == NULL) -goto error; if (++depth 100) goto error; +if ((filename = TransFileName(im, tokenbuf)) == NULL) +goto error; infp = _XFopenFile(filename, r); Xfree(filename); if (infp == NULL) For both patches, Reviewed-by: Alan Coopersmith alan.coopersm...@oracle.com Thanks, -- -Alan Coopersmith- alan.coopersm...@oracle.com Oracle Solaris Engineering - http://blogs.oracle.com/alanc ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PULL] Removal of 10-evdev.conf
Sending a separate pull request, just to make it stick out more. This requires the most recent evdev driver (66c997), at least on new installs. if you already have the file somewhere locally it doesn't matter. The following changes since commit bf6344e1913a5d24c2d68eaca999ea3d71e1b707: Revert glx/dri2: Disable AIGLX if indirect GLX is disabled (2015-05-14 21:29:40 -0700) are available in the git repository at: git://people.freedesktop.org/~whot/xserver for-keith for you to fetch changes up to fc59c8fe8d941b0ec1e98c59bc57b1f97dba149d: config: remove 10-evdev.conf, let the evdev driver install that file (2015-05-18 13:41:09 +1000) Peter Hutterer (1): config: remove 10-evdev.conf, let the evdev driver install that file config/10-evdev.conf | 40 config/Makefile.am | 4 ++-- 2 files changed, 2 insertions(+), 42 deletions(-) delete mode 100644 config/10-evdev.conf pgpQ094DwggV6.pgp Description: PGP signature ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH libX11] Fix three use of uninitialized variable coverity warnings
False positive, if rlen/nbytes are unset we quit early before using it. Still, initialize it so we don't have to deal with these warnings again. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- src/FontNames.c | 2 +- src/GetFPath.c | 2 +- src/ListExt.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/FontNames.c b/src/FontNames.c index 6fc6b12..21dcafe 100644 --- a/src/FontNames.c +++ b/src/FontNames.c @@ -47,7 +47,7 @@ int *actualCount) /* RETURN */ int count = 0; xListFontsReply rep; register xListFontsReq *req; -unsigned long rlen; +unsigned long rlen = 0; LockDisplay(dpy); GetReq(ListFonts, req); diff --git a/src/GetFPath.c b/src/GetFPath.c index 62ba014..8c3f49c 100644 --- a/src/GetFPath.c +++ b/src/GetFPath.c @@ -35,7 +35,7 @@ char **XGetFontPath( int *npaths) /* RETURN */ { xGetFontPathReply rep; - unsigned long nbytes; + unsigned long nbytes = 0; char **flist = NULL; char *ch = NULL; char *chend; diff --git a/src/ListExt.c b/src/ListExt.c index 431ae67..be6b989 100644 --- a/src/ListExt.c +++ b/src/ListExt.c @@ -42,7 +42,7 @@ char **XListExtensions( register unsigned i; register int length; register xReq *req; - unsigned long rlen; + unsigned long rlen = 0; LockDisplay(dpy); GetEmptyReq (ListExtensions, req); -- 2.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH libX11 1/2] Fix potential memory leak
Hi, On 18-05-15 00:54, Peter Hutterer wrote: If we hit the depth limit, filename leaks. Move the depth check up before we allocate filename. Introduced in 226622349a4b1e16064649da34fb4be4f464. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net Both look good to me: Reviewed-by: Hans de Goede hdego...@redhat.com Regards, Hans --- modules/im/ximcp/imLcPrs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/im/ximcp/imLcPrs.c b/modules/im/ximcp/imLcPrs.c index 9bb45ff..4979975 100644 --- a/modules/im/ximcp/imLcPrs.c +++ b/modules/im/ximcp/imLcPrs.c @@ -496,10 +496,10 @@ parseline( token = nexttoken(fp, tokenbuf, lastch); if (token != KEY token != STRING) goto error; -if ((filename = TransFileName(im, tokenbuf)) == NULL) -goto error; if (++depth 100) goto error; +if ((filename = TransFileName(im, tokenbuf)) == NULL) +goto error; infp = _XFopenFile(filename, r); Xfree(filename); if (infp == NULL) ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel