mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
protect against broken apps
This commit is contained in:
parent
63f025c5ad
commit
4c75d90ad2
1 changed files with 11 additions and 4 deletions
|
|
@ -827,10 +827,17 @@ wglSetPixelFormat(HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR * ppfd)
|
|||
|
||||
qt_valid_pix = qt_pix;
|
||||
|
||||
if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix
|
||||
|| ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR)) {
|
||||
SetLastError(0);
|
||||
return (FALSE);
|
||||
if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix) {
|
||||
if (ppfd == NULL) {
|
||||
PIXELFORMATDESCRIPTOR my_pfd;
|
||||
if (!wglDescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &my_pfd)) {
|
||||
SetLastError(0);
|
||||
return (FALSE);
|
||||
}
|
||||
} else if (ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR)) {
|
||||
SetLastError(0);
|
||||
return (FALSE);
|
||||
}
|
||||
}
|
||||
curPFD = iPixelFormat;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue