summaryrefslogtreecommitdiff
path: root/hw/xwin
diff options
context:
space:
mode:
authordslater38 <dslater38@gmail.com>2019-12-12 04:54:46 +0000
committerPeter Hutterer <peter.hutterer@who-t.net>2019-12-12 04:54:46 +0000
commit71c3a97142265804d64f443bd1ddb68ac356f8a3 (patch)
tree9b95789a2783e44d7ebbda9538626497e6c4c6e8 /hw/xwin
parent0c729bb958375fbd8fb6811ff1ecc88bd9f80282 (diff)
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.
Diffstat (limited to 'hw/xwin')
-rw-r--r--hw/xwin/glx/indirect.c3
1 files changed, 1 insertions, 2 deletions
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;
}