xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 12 04:54:48 UTC 2019


 hw/xwin/glx/indirect.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 71c3a97142265804d64f443bd1ddb68ac356f8a3
Author: dslater38 <dslater38 at gmail.com>
Date:   Thu Dec 12 04:54:46 2019 +0000

    XWin: Fix infinite loop in GetShift()
    
    GetShift(int mask) can be called with mask==0, causing
    it to go into an infinite loop.
    
    Note: GetShift(mask) will return 0 for a mask of
    both 0 and -1. The assumption is that if mask == 0,
    then the corresponding bits for which we're calculating
    the shift, are also 0.

diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 38605914a..59ee17fb1 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -1597,8 +1597,7 @@ static int
 GetShift(int mask)
 {
     int shift = 0;
-
-    while ((mask &1) == 0) {
+    while (mask > 1) {
         shift++;
         mask >>=1;
     }


More information about the xorg-commit mailing list