Avoid segfaults in XF86VidMode GammaRamp functions if randr_crtc is NULL
Fixes crash when xscreensaver tries to use GammaRamp calls to fade out http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6915712 Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
19d03d4f49
commit
0038290728
|
@ -1004,6 +1004,7 @@ xf86ChangeGammaRamp(
|
||||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||||
RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
|
RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
|
||||||
|
|
||||||
|
if (crtc) {
|
||||||
if (crtc->gammaSize != size)
|
if (crtc->gammaSize != size)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
|
@ -1011,6 +1012,7 @@ xf86ChangeGammaRamp(
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(CMapScreenKey == NULL)
|
if(CMapScreenKey == NULL)
|
||||||
return BadImplementation;
|
return BadImplementation;
|
||||||
|
@ -1077,6 +1079,7 @@ xf86GetGammaRampSize(ScreenPtr pScreen)
|
||||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||||
RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
|
RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
|
||||||
|
|
||||||
|
if (crtc)
|
||||||
return crtc->gammaSize;
|
return crtc->gammaSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1106,6 +1109,7 @@ xf86GetGammaRamp(
|
||||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||||
RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
|
RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
|
||||||
|
|
||||||
|
if (crtc) {
|
||||||
if (crtc->gammaSize < size)
|
if (crtc->gammaSize < size)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
|
@ -1118,6 +1122,7 @@ xf86GetGammaRamp(
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(CMapScreenKey == NULL)
|
if(CMapScreenKey == NULL)
|
||||||
return BadImplementation;
|
return BadImplementation;
|
||||||
|
|
Loading…
Reference in New Issue