From fe93dea684c520f7f92e4ee313d2c01e70d55469 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Fri, 16 Jan 2009 13:35:05 -0800 Subject: [PATCH] fix FPE when initializing screen The radeon driver under strange situations when plugging/unplugging an external display can call fbScreenInit with 0 sizes, leading to an FPE. Ubuntu: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/317957 Signed-off-by: Kees Cook --- mi/miscrinit.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mi/miscrinit.c b/mi/miscrinit.c index 157a17f..8ac66fe 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -219,8 +219,8 @@ miScreenInit( { pScreen->width = xsize; pScreen->height = ysize; - pScreen->mmWidth = (xsize * 254 + dpix * 5) / (dpix * 10); - pScreen->mmHeight = (ysize * 254 + dpiy * 5) / (dpiy * 10); + pScreen->mmWidth = dpix ? (xsize * 254 + dpix * 5) / (dpix * 10) : 0; + pScreen->mmHeight = dpiy ? (ysize * 254 + dpiy * 5) / (dpiy * 10) : 0; pScreen->numDepths = numDepths; pScreen->rootDepth = rootDepth; pScreen->allowedDepths = depths; -- 1.6.0.4