|
Lines 723-728
ProcPanoramiXShmCreatePixmap(
|
Link Here
|
|---|
|
int i, j, result; | int i, j, result; |
ShmDescPtr shmdesc; | ShmDescPtr shmdesc; |
REQUEST(xShmCreatePixmapReq); | REQUEST(xShmCreatePixmapReq); |
|
unsigned int width, height, depth; |
|
unsigned long size; |
PanoramiXRes *newPix; | PanoramiXRes *newPix; |
| |
REQUEST_SIZE_MATCH(xShmCreatePixmapReq); | REQUEST_SIZE_MATCH(xShmCreatePixmapReq); |
|
Lines 732-742
ProcPanoramiXShmCreatePixmap(
|
Link Here
|
|---|
|
LEGAL_NEW_RESOURCE(stuff->pid, client); | LEGAL_NEW_RESOURCE(stuff->pid, client); |
VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client); | VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client); |
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); | VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); |
if (!stuff->width || !stuff->height) |
|
|
width = stuff->width; |
|
height = stuff->height; |
|
depth = stuff->depth; |
|
if (!width || !height || !depth) |
{ | { |
client->errorValue = 0; | client->errorValue = 0; |
return BadValue; | return BadValue; |
} | } |
|
if (width > 32767 || height > 32767) |
|
return BadAlloc; |
|
size = PixmapBytePad(width, depth) * height; |
|
if (sizeof(size) == 4) { |
|
if (size < width * height) |
|
return BadAlloc; |
|
/* thankfully, offset is unsigned */ |
|
if (stuff->offset + size < size) |
|
return BadAlloc; |
|
} |
|
|
if (stuff->depth != 1) | if (stuff->depth != 1) |
{ | { |
pDepth = pDraw->pScreen->allowedDepths; | pDepth = pDraw->pScreen->allowedDepths; |
|
Lines 747-755
ProcPanoramiXShmCreatePixmap(
|
Link Here
|
|---|
|
return BadValue; | return BadValue; |
} | } |
CreatePmap: | CreatePmap: |
VERIFY_SHMSIZE(shmdesc, stuff->offset, |
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client); |
PixmapBytePad(stuff->width, stuff->depth) * stuff->height, |
|
client); |
|
| |
if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) | if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) |
return BadAlloc; | return BadAlloc; |
|
Lines 1047-1052
ProcShmCreatePixmap(client)
|
Link Here
|
|---|
|
register int i; | register int i; |
ShmDescPtr shmdesc; | ShmDescPtr shmdesc; |
REQUEST(xShmCreatePixmapReq); | REQUEST(xShmCreatePixmapReq); |
|
unsigned int width, height, depth; |
|
unsigned long size; |
| |
REQUEST_SIZE_MATCH(xShmCreatePixmapReq); | REQUEST_SIZE_MATCH(xShmCreatePixmapReq); |
client->errorValue = stuff->pid; | client->errorValue = stuff->pid; |
|
Lines 1055-1065
ProcShmCreatePixmap(client)
|
Link Here
|
|---|
|
LEGAL_NEW_RESOURCE(stuff->pid, client); | LEGAL_NEW_RESOURCE(stuff->pid, client); |
VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client); | VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client); |
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); | VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); |
if (!stuff->width || !stuff->height) |
|
|
width = stuff->width; |
|
height = stuff->height; |
|
depth = stuff->depth; |
|
if (!width || !height || !depth) |
{ | { |
client->errorValue = 0; | client->errorValue = 0; |
return BadValue; | return BadValue; |
} | } |
|
if (width > 32767 || height > 32767) |
|
return BadAlloc; |
|
size = PixmapBytePad(width, depth) * height; |
|
if (sizeof(size) == 4) { |
|
if (size < width * height) |
|
return BadAlloc; |
|
/* thankfully, offset is unsigned */ |
|
if (stuff->offset + size < size) |
|
return BadAlloc; |
|
} |
|
|
if (stuff->depth != 1) | if (stuff->depth != 1) |
{ | { |
pDepth = pDraw->pScreen->allowedDepths; | pDepth = pDraw->pScreen->allowedDepths; |
|
Lines 1070-1078
ProcShmCreatePixmap(client)
|
Link Here
|
|---|
|
return BadValue; | return BadValue; |
} | } |
CreatePmap: | CreatePmap: |
VERIFY_SHMSIZE(shmdesc, stuff->offset, |
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client); |
PixmapBytePad(stuff->width, stuff->depth) * stuff->height, |
|
client); |
|
pMap = (*shmFuncs[pDraw->pScreen->myNum]->CreatePixmap)( | pMap = (*shmFuncs[pDraw->pScreen->myNum]->CreatePixmap)( |
pDraw->pScreen, stuff->width, | pDraw->pScreen, stuff->width, |
stuff->height, stuff->depth, | stuff->height, stuff->depth, |