idx
int64
func_before
string
Vulnerability Classification
string
vul
int64
func_after
string
patch
string
CWE ID
string
lines_before
string
lines_after
string
9,100
fbFetchPixel_b2g3r3 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); CARD32 r,g,b; b = (((pixel & 0xc0) ) | ((pixel & 0xc0) >> 2) | ((pixel & 0xc0) >> 4) | ((pixel & 0xc0) >> 6)); g = ((pixel & 0x38) | ((pixel & 0x38) >> 3) | ((pixel & 0x30) << 2)) << 8; r = (((pixel & 0x07) ) | ((pixel & 0x07) << 3) | ((pixel & 0x06) << 6)) << 16; return (0xff000000 | r | g | b); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_b2g3r3 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); CARD32 r,g,b; b = (((pixel & 0xc0) ) | ((pixel & 0xc0) >> 2) | ((pixel & 0xc0) >> 4) | ((pixel & 0xc0) >> 6)); g = ((pixel & 0x38) | ((pixel & 0x38) >> 3) | ((pixel & 0x30) << 2)) << 8; r = (((pixel & 0x07) ) | ((pixel & 0x07) << 3) | ((pixel & 0x06) << 6)) << 16; return (0xff000000 | r | g | b); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,101
fbFetchPixel_b5g6r5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 r,g,b; b = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) >> 8; g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5; r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; return (0xff000000 | r | g | b); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_b5g6r5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 r,g,b; b = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) >> 8; g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5; r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; return (0xff000000 | r | g | b); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,102
fbFetchPixel_b8g8r8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD8 *pixel = ((CARD8 *) bits) + (offset*3); #if IMAGE_BYTE_ORDER == MSBFirst return (0xff000000 | (READ(pixel + 2) << 16) | (READ(pixel + 1) << 8) | (READ(pixel + 0))); #else return (0xff000000 | (READ(pixel + 0) << 16) | (READ(pixel + 1) << 8) | (READ(pixel + 2))); #endif }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_b8g8r8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD8 *pixel = ((CARD8 *) bits) + (offset*3); #if IMAGE_BYTE_ORDER == MSBFirst return (0xff000000 | (READ(pixel + 2) << 16) | (READ(pixel + 1) << 8) | (READ(pixel + 0))); #else return (0xff000000 | (READ(pixel + 0) << 16) | (READ(pixel + 1) << 8) | (READ(pixel + 2))); #endif }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,103
fbFetchPixel_c4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); return indexed->rgba[pixel]; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_c4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); return indexed->rgba[pixel]; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,104
fbFetchPixel_c8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); return indexed->rgba[pixel]; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_c8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); return indexed->rgba[pixel]; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,105
fbFetchPixel_g1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD32 *)bits)[offset >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = pixel >> (0x1f - (offset & 0x1f)); #else a = pixel >> (offset & 0x1f); #endif a = a & 1; return indexed->rgba[a]; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_g1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD32 *)bits)[offset >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = pixel >> (0x1f - (offset & 0x1f)); #else a = pixel >> (offset & 0x1f); #endif a = a & 1; return indexed->rgba[a]; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,106
fbFetchPixel_r1g2b1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); CARD32 r,g,b; r = ((pixel & 0x8) * 0xff) << 13; g = ((pixel & 0x6) * 0x55) << 7; b = ((pixel & 0x1) * 0xff); return 0xff000000|r|g|b; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_r1g2b1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); CARD32 r,g,b; r = ((pixel & 0x8) * 0xff) << 13; g = ((pixel & 0x6) * 0x55) << 7; b = ((pixel & 0x1) * 0xff); return 0xff000000|r|g|b; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,107
fbFetchPixel_r3g3b2 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); CARD32 r,g,b; r = ((pixel & 0xe0) | ((pixel & 0xe0) >> 3) | ((pixel & 0xc0) >> 6)) << 16; g = ((pixel & 0x1c) | ((pixel & 0x18) >> 3) | ((pixel & 0x1c) << 3)) << 8; b = (((pixel & 0x03) ) | ((pixel & 0x03) << 2) | ((pixel & 0x03) << 4) | ((pixel & 0x03) << 6)); return (0xff000000 | r | g | b); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_r3g3b2 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); CARD32 r,g,b; r = ((pixel & 0xe0) | ((pixel & 0xe0) >> 3) | ((pixel & 0xc0) >> 6)) << 16; g = ((pixel & 0x1c) | ((pixel & 0x18) >> 3) | ((pixel & 0x1c) << 3)) << 8; b = (((pixel & 0x03) ) | ((pixel & 0x03) << 2) | ((pixel & 0x03) << 4) | ((pixel & 0x03) << 6)); return (0xff000000 | r | g | b); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,108
fbFetchPixel_r5g6b5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 r,g,b; r = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) << 8; g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5; b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; return (0xff000000 | r | g | b); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_r5g6b5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 r,g,b; r = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) << 8; g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5; b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; return (0xff000000 | r | g | b); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,109
fbFetchPixel_r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD8 *pixel = ((CARD8 *) bits) + (offset*3); #if IMAGE_BYTE_ORDER == MSBFirst return (0xff000000 | (READ(pixel + 0) << 16) | (READ(pixel + 1) << 8) | (READ(pixel + 2))); #else return (0xff000000 | (READ(pixel + 2) << 16) | (READ(pixel + 1) << 8) | (READ(pixel + 0))); #endif }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD8 *pixel = ((CARD8 *) bits) + (offset*3); #if IMAGE_BYTE_ORDER == MSBFirst return (0xff000000 | (READ(pixel + 0) << 16) | (READ(pixel + 1) << 8) | (READ(pixel + 2))); #else return (0xff000000 | (READ(pixel + 2) << 16) | (READ(pixel + 1) << 8) | (READ(pixel + 0))); #endif }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,110
fbFetchPixel_x1b5g5r5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 r,g,b; b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; return (0xff000000 | r | g | b); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_x1b5g5r5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 r,g,b; b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; return (0xff000000 | r | g | b); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,111
fbFetchPixel_x1r5g5b5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 r,g,b; r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; return (0xff000000 | r | g | b); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_x1r5g5b5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 r,g,b; r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; return (0xff000000 | r | g | b); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,112
fbFetchPixel_x4a4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); return ((pixel & 0xf) | ((pixel & 0xf) << 4)) << 24; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_x4a4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); return ((pixel & 0xf) | ((pixel & 0xf) << 4)) << 24; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,113
fbFetchPixel_x4b4g4r4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 r,g,b; b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4; g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)) << 16; return (0xff000000 | r | g | b); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_x4b4g4r4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 r,g,b; b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4; g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)) << 16; return (0xff000000 | r | g | b); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,114
fbFetchPixel_x4r4g4b4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 r,g,b; r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); return (0xff000000 | r | g | b); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_x4r4g4b4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 r,g,b; r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); return (0xff000000 | r | g | b); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,115
static void fbFetchSolid(PicturePtr pict, int x, int y, int width, CARD32 *buffer, CARD32 *mask, CARD32 maskBits) { FbBits *bits; FbStride stride; int bpp; int xoff, yoff; CARD32 color; CARD32 *end; fetchPixelProc fetch = fetchPixelProcForPicture(pict); miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); bits += yoff*stride + (xoff*bpp >> FB_SHIFT); color = fetch(bits, 0, indexed); end = buffer + width; while (buffer < end) WRITE(buffer++, color); fbFinishAccess (pict->pDrawable); }
DoS Exec Code Mem. Corr.
0
static void fbFetchSolid(PicturePtr pict, int x, int y, int width, CARD32 *buffer, CARD32 *mask, CARD32 maskBits) { FbBits *bits; FbStride stride; int bpp; int xoff, yoff; CARD32 color; CARD32 *end; fetchPixelProc fetch = fetchPixelProcForPicture(pict); miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); bits += yoff*stride + (xoff*bpp >> FB_SHIFT); color = fetch(bits, 0, indexed); end = buffer + width; while (buffer < end) WRITE(buffer++, color); fbFinishAccess (pict->pDrawable); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,116
static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 *buffer, CARD32 *mask, CARD32 maskBits) { FbBits *bits; FbStride stride; int bpp; int xoff, yoff, dx, dy; fetchPixelProc fetch; PictVector v; PictVector unit; int i; BoxRec box; miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; Bool affine = TRUE; fetch = fetchPixelProcForPicture(pict); fbGetDrawable(pict->pDrawable, bits, stride, bpp, xoff, yoff); x += xoff; y += yoff; dx = pict->pDrawable->x; dy = pict->pDrawable->y; /* reference point is the center of the pixel */ v.vector[0] = IntToxFixed(x - dx) + xFixed1 / 2; v.vector[1] = IntToxFixed(y - dy) + xFixed1 / 2; v.vector[2] = xFixed1; /* when using convolution filters one might get here without a transform */ if (pict->transform) { if (!PictureTransformPoint3d (pict->transform, &v)) { fbFinishAccess (pict->pDrawable); return; } unit.vector[0] = pict->transform->matrix[0][0]; unit.vector[1] = pict->transform->matrix[1][0]; unit.vector[2] = pict->transform->matrix[2][0]; affine = v.vector[2] == xFixed1 && unit.vector[2] == 0; } else { unit.vector[0] = xFixed1; unit.vector[1] = 0; unit.vector[2] = 0; } if (pict->filter == PictFilterNearest) { if (pict->repeatType == RepeatNormal) { if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { if (!affine) { y = MOD(DIV(v.vector[1],v.vector[2]), pict->pDrawable->height); x = MOD(DIV(v.vector[0],v.vector[2]), pict->pDrawable->width); } else { y = MOD(v.vector[1]>>16, pict->pDrawable->height); x = MOD(v.vector[0]>>16, pict->pDrawable->width); } WRITE(buffer + i, fetch(bits + (y + dy)*stride, x + dx, indexed)); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } else { for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { if (!affine) { y = MOD(DIV(v.vector[1],v.vector[2]), pict->pDrawable->height); x = MOD(DIV(v.vector[0],v.vector[2]), pict->pDrawable->width); } else { y = MOD(v.vector[1]>>16, pict->pDrawable->height); x = MOD(v.vector[0]>>16, pict->pDrawable->width); } if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box)) WRITE(buffer + i, fetch(bits + (y + dy)*stride, x + dx, indexed)); else WRITE(buffer + i, 0); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } else { if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { if (!affine) { y = DIV(v.vector[1],v.vector[2]); x = DIV(v.vector[0],v.vector[2]); } else { y = v.vector[1]>>16; x = v.vector[0]>>16; } WRITE(buffer + i, ((x < box.x1-dx) | (x >= box.x2-dx) | (y < box.y1-dy) | (y >= box.y2-dy)) ? 0 : fetch(bits + (y + dy)*stride, x + dx, indexed)); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } else { for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { if (!affine) { y = DIV(v.vector[1],v.vector[2]); x = DIV(v.vector[0],v.vector[2]); } else { y = v.vector[1]>>16; x = v.vector[0]>>16; } if (POINT_IN_REGION (0, pict->pCompositeClip, x + dx, y + dy, &box)) WRITE(buffer + i, fetch(bits + (y + dy)*stride, x + dx, indexed)); else WRITE(buffer + i, 0); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } } else if (pict->filter == PictFilterBilinear) { /* adjust vector for maximum contribution at 0.5, 0.5 of each texel. */ v.vector[0] -= v.vector[2] / 2; v.vector[1] -= v.vector[2] / 2; unit.vector[0] -= unit.vector[2] / 2; unit.vector[1] -= unit.vector[2] / 2; if (pict->repeatType == RepeatNormal) { if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { int x1, x2, y1, y2, distx, idistx, disty, idisty; FbBits *b; CARD32 tl, tr, bl, br, r; CARD32 ft, fb; if (!affine) { xFixed_48_16 div; div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; x1 = div >> 16; distx = ((xFixed)div >> 8) & 0xff; div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; y1 = div >> 16; disty = ((xFixed)div >> 8) & 0xff; } else { x1 = v.vector[0] >> 16; distx = (v.vector[0] >> 8) & 0xff; y1 = v.vector[1] >> 16; disty = (v.vector[1] >> 8) & 0xff; } x2 = x1 + 1; y2 = y1 + 1; idistx = 256 - distx; idisty = 256 - disty; x1 = MOD (x1, pict->pDrawable->width); x2 = MOD (x2, pict->pDrawable->width); y1 = MOD (y1, pict->pDrawable->height); y2 = MOD (y2, pict->pDrawable->height); b = bits + (y1 + dy)*stride; tl = fetch(b, x1 + dx, indexed); tr = fetch(b, x2 + dx, indexed); b = bits + (y2 + dy)*stride; bl = fetch(b, x1 + dx, indexed); br = fetch(b, x2 + dx, indexed); ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; r = (((ft * idisty + fb * disty) >> 16) & 0xff); ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; r |= (((ft * idisty + fb * disty)) & 0xff0000); ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); WRITE(buffer + i, r); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } else { for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { int x1, x2, y1, y2, distx, idistx, disty, idisty; FbBits *b; CARD32 tl, tr, bl, br, r; CARD32 ft, fb; if (!affine) { xFixed_48_16 div; div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; x1 = div >> 16; distx = ((xFixed)div >> 8) & 0xff; div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; y1 = div >> 16; disty = ((xFixed)div >> 8) & 0xff; } else { x1 = v.vector[0] >> 16; distx = (v.vector[0] >> 8) & 0xff; y1 = v.vector[1] >> 16; disty = (v.vector[1] >> 8) & 0xff; } x2 = x1 + 1; y2 = y1 + 1; idistx = 256 - distx; idisty = 256 - disty; x1 = MOD (x1, pict->pDrawable->width); x2 = MOD (x2, pict->pDrawable->width); y1 = MOD (y1, pict->pDrawable->height); y2 = MOD (y2, pict->pDrawable->height); b = bits + (y1 + dy)*stride; tl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y1 + dy, &box) ? fetch(b, x1 + dx, indexed) : 0; tr = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y1 + dy, &box) ? fetch(b, x2 + dx, indexed) : 0; b = bits + (y2 + dy)*stride; bl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y2 + dy, &box) ? fetch(b, x1 + dx, indexed) : 0; br = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y2 + dy, &box) ? fetch(b, x2 + dx, indexed) : 0; ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; r = (((ft * idisty + fb * disty) >> 16) & 0xff); ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; r |= (((ft * idisty + fb * disty)) & 0xff0000); ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); WRITE(buffer + i, r); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } else { if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off; FbBits *b; CARD32 tl, tr, bl, br, r; Bool x1_out, x2_out, y1_out, y2_out; CARD32 ft, fb; if (!affine) { xFixed_48_16 div; div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; x1 = div >> 16; distx = ((xFixed)div >> 8) & 0xff; div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; y1 = div >> 16; disty = ((xFixed)div >> 8) & 0xff; } else { x1 = v.vector[0] >> 16; distx = (v.vector[0] >> 8) & 0xff; y1 = v.vector[1] >> 16; disty = (v.vector[1] >> 8) & 0xff; } x2 = x1 + 1; y2 = y1 + 1; idistx = 256 - distx; idisty = 256 - disty; b = bits + (y1 + dy)*stride; x_off = x1 + dx; x1_out = (x1 < box.x1-dx) | (x1 >= box.x2-dx); x2_out = (x2 < box.x1-dx) | (x2 >= box.x2-dx); y1_out = (y1 < box.y1-dy) | (y1 >= box.y2-dy); y2_out = (y2 < box.y1-dy) | (y2 >= box.y2-dy); tl = x1_out|y1_out ? 0 : fetch(b, x_off, indexed); tr = x2_out|y1_out ? 0 : fetch(b, x_off + 1, indexed); b += stride; bl = x1_out|y2_out ? 0 : fetch(b, x_off, indexed); br = x2_out|y2_out ? 0 : fetch(b, x_off + 1, indexed); ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; r = (((ft * idisty + fb * disty) >> 16) & 0xff); ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; r |= (((ft * idisty + fb * disty)) & 0xff0000); ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); WRITE(buffer + i, r); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } else { for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off; FbBits *b; CARD32 tl, tr, bl, br, r; CARD32 ft, fb; if (!affine) { xFixed_48_16 div; div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; x1 = div >> 16; distx = ((xFixed)div >> 8) & 0xff; div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; y1 = div >> 16; disty = ((xFixed)div >> 8) & 0xff; } else { x1 = v.vector[0] >> 16; distx = (v.vector[0] >> 8) & 0xff; y1 = v.vector[1] >> 16; disty = (v.vector[1] >> 8) & 0xff; } x2 = x1 + 1; y2 = y1 + 1; idistx = 256 - distx; idisty = 256 - disty; b = bits + (y1 + dy)*stride; x_off = x1 + dx; tl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y1 + dy, &box) ? fetch(b, x_off, indexed) : 0; tr = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y1 + dy, &box) ? fetch(b, x_off + 1, indexed) : 0; b += stride; bl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y2 + dy, &box) ? fetch(b, x_off, indexed) : 0; br = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y2 + dy, &box) ? fetch(b, x_off + 1, indexed) : 0; ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; r = (((ft * idisty + fb * disty) >> 16) & 0xff); ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; r |= (((ft * idisty + fb * disty)) & 0xff0000); ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); WRITE(buffer + i, r); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } } else if (pict->filter == PictFilterConvolution) { xFixed *params = pict->filter_params; INT32 cwidth = xFixedToInt(params[0]); INT32 cheight = xFixedToInt(params[1]); int xoff = (params[0] - xFixed1) >> 1; int yoff = (params[1] - xFixed1) >> 1; params += 2; for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { int x1, x2, y1, y2, x, y; INT32 srtot, sgtot, sbtot, satot; xFixed *p = params; if (!affine) { xFixed_48_16 tmp; tmp = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2] - xoff; x1 = xFixedToInt(tmp); tmp = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2] - yoff; y1 = xFixedToInt(tmp); } else { x1 = xFixedToInt(v.vector[0] - xoff); y1 = xFixedToInt(v.vector[1] - yoff); } x2 = x1 + cwidth; y2 = y1 + cheight; srtot = sgtot = sbtot = satot = 0; for (y = y1; y < y2; y++) { int ty = (pict->repeatType == RepeatNormal) ? MOD (y, pict->pDrawable->height) : y; for (x = x1; x < x2; x++) { if (*p) { int tx = (pict->repeatType == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x; if (POINT_IN_REGION (0, pict->pCompositeClip, tx + dx, ty + dy, &box)) { FbBits *b = bits + (ty + dy)*stride; CARD32 c = fetch(b, tx + dx, indexed); srtot += Red(c) * *p; sgtot += Green(c) * *p; sbtot += Blue(c) * *p; satot += Alpha(c) * *p; } } p++; } } satot >>= 16; srtot >>= 16; sgtot >>= 16; sbtot >>= 16; if (satot < 0) satot = 0; else if (satot > 0xff) satot = 0xff; if (srtot < 0) srtot = 0; else if (srtot > 0xff) srtot = 0xff; if (sgtot < 0) sgtot = 0; else if (sgtot > 0xff) sgtot = 0xff; if (sbtot < 0) sbtot = 0; else if (sbtot > 0xff) sbtot = 0xff; WRITE(buffer + i, ((satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot ))); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } fbFinishAccess (pict->pDrawable); }
DoS Exec Code Mem. Corr.
0
static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 *buffer, CARD32 *mask, CARD32 maskBits) { FbBits *bits; FbStride stride; int bpp; int xoff, yoff, dx, dy; fetchPixelProc fetch; PictVector v; PictVector unit; int i; BoxRec box; miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; Bool affine = TRUE; fetch = fetchPixelProcForPicture(pict); fbGetDrawable(pict->pDrawable, bits, stride, bpp, xoff, yoff); x += xoff; y += yoff; dx = pict->pDrawable->x; dy = pict->pDrawable->y; /* reference point is the center of the pixel */ v.vector[0] = IntToxFixed(x - dx) + xFixed1 / 2; v.vector[1] = IntToxFixed(y - dy) + xFixed1 / 2; v.vector[2] = xFixed1; /* when using convolution filters one might get here without a transform */ if (pict->transform) { if (!PictureTransformPoint3d (pict->transform, &v)) { fbFinishAccess (pict->pDrawable); return; } unit.vector[0] = pict->transform->matrix[0][0]; unit.vector[1] = pict->transform->matrix[1][0]; unit.vector[2] = pict->transform->matrix[2][0]; affine = v.vector[2] == xFixed1 && unit.vector[2] == 0; } else { unit.vector[0] = xFixed1; unit.vector[1] = 0; unit.vector[2] = 0; } if (pict->filter == PictFilterNearest) { if (pict->repeatType == RepeatNormal) { if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { if (!affine) { y = MOD(DIV(v.vector[1],v.vector[2]), pict->pDrawable->height); x = MOD(DIV(v.vector[0],v.vector[2]), pict->pDrawable->width); } else { y = MOD(v.vector[1]>>16, pict->pDrawable->height); x = MOD(v.vector[0]>>16, pict->pDrawable->width); } WRITE(buffer + i, fetch(bits + (y + dy)*stride, x + dx, indexed)); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } else { for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { if (!affine) { y = MOD(DIV(v.vector[1],v.vector[2]), pict->pDrawable->height); x = MOD(DIV(v.vector[0],v.vector[2]), pict->pDrawable->width); } else { y = MOD(v.vector[1]>>16, pict->pDrawable->height); x = MOD(v.vector[0]>>16, pict->pDrawable->width); } if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box)) WRITE(buffer + i, fetch(bits + (y + dy)*stride, x + dx, indexed)); else WRITE(buffer + i, 0); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } else { if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { if (!affine) { y = DIV(v.vector[1],v.vector[2]); x = DIV(v.vector[0],v.vector[2]); } else { y = v.vector[1]>>16; x = v.vector[0]>>16; } WRITE(buffer + i, ((x < box.x1-dx) | (x >= box.x2-dx) | (y < box.y1-dy) | (y >= box.y2-dy)) ? 0 : fetch(bits + (y + dy)*stride, x + dx, indexed)); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } else { for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { if (!affine) { y = DIV(v.vector[1],v.vector[2]); x = DIV(v.vector[0],v.vector[2]); } else { y = v.vector[1]>>16; x = v.vector[0]>>16; } if (POINT_IN_REGION (0, pict->pCompositeClip, x + dx, y + dy, &box)) WRITE(buffer + i, fetch(bits + (y + dy)*stride, x + dx, indexed)); else WRITE(buffer + i, 0); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } } else if (pict->filter == PictFilterBilinear) { /* adjust vector for maximum contribution at 0.5, 0.5 of each texel. */ v.vector[0] -= v.vector[2] / 2; v.vector[1] -= v.vector[2] / 2; unit.vector[0] -= unit.vector[2] / 2; unit.vector[1] -= unit.vector[2] / 2; if (pict->repeatType == RepeatNormal) { if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { int x1, x2, y1, y2, distx, idistx, disty, idisty; FbBits *b; CARD32 tl, tr, bl, br, r; CARD32 ft, fb; if (!affine) { xFixed_48_16 div; div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; x1 = div >> 16; distx = ((xFixed)div >> 8) & 0xff; div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; y1 = div >> 16; disty = ((xFixed)div >> 8) & 0xff; } else { x1 = v.vector[0] >> 16; distx = (v.vector[0] >> 8) & 0xff; y1 = v.vector[1] >> 16; disty = (v.vector[1] >> 8) & 0xff; } x2 = x1 + 1; y2 = y1 + 1; idistx = 256 - distx; idisty = 256 - disty; x1 = MOD (x1, pict->pDrawable->width); x2 = MOD (x2, pict->pDrawable->width); y1 = MOD (y1, pict->pDrawable->height); y2 = MOD (y2, pict->pDrawable->height); b = bits + (y1 + dy)*stride; tl = fetch(b, x1 + dx, indexed); tr = fetch(b, x2 + dx, indexed); b = bits + (y2 + dy)*stride; bl = fetch(b, x1 + dx, indexed); br = fetch(b, x2 + dx, indexed); ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; r = (((ft * idisty + fb * disty) >> 16) & 0xff); ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; r |= (((ft * idisty + fb * disty)) & 0xff0000); ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); WRITE(buffer + i, r); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } else { for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { int x1, x2, y1, y2, distx, idistx, disty, idisty; FbBits *b; CARD32 tl, tr, bl, br, r; CARD32 ft, fb; if (!affine) { xFixed_48_16 div; div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; x1 = div >> 16; distx = ((xFixed)div >> 8) & 0xff; div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; y1 = div >> 16; disty = ((xFixed)div >> 8) & 0xff; } else { x1 = v.vector[0] >> 16; distx = (v.vector[0] >> 8) & 0xff; y1 = v.vector[1] >> 16; disty = (v.vector[1] >> 8) & 0xff; } x2 = x1 + 1; y2 = y1 + 1; idistx = 256 - distx; idisty = 256 - disty; x1 = MOD (x1, pict->pDrawable->width); x2 = MOD (x2, pict->pDrawable->width); y1 = MOD (y1, pict->pDrawable->height); y2 = MOD (y2, pict->pDrawable->height); b = bits + (y1 + dy)*stride; tl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y1 + dy, &box) ? fetch(b, x1 + dx, indexed) : 0; tr = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y1 + dy, &box) ? fetch(b, x2 + dx, indexed) : 0; b = bits + (y2 + dy)*stride; bl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y2 + dy, &box) ? fetch(b, x1 + dx, indexed) : 0; br = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y2 + dy, &box) ? fetch(b, x2 + dx, indexed) : 0; ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; r = (((ft * idisty + fb * disty) >> 16) & 0xff); ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; r |= (((ft * idisty + fb * disty)) & 0xff0000); ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); WRITE(buffer + i, r); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } else { if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off; FbBits *b; CARD32 tl, tr, bl, br, r; Bool x1_out, x2_out, y1_out, y2_out; CARD32 ft, fb; if (!affine) { xFixed_48_16 div; div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; x1 = div >> 16; distx = ((xFixed)div >> 8) & 0xff; div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; y1 = div >> 16; disty = ((xFixed)div >> 8) & 0xff; } else { x1 = v.vector[0] >> 16; distx = (v.vector[0] >> 8) & 0xff; y1 = v.vector[1] >> 16; disty = (v.vector[1] >> 8) & 0xff; } x2 = x1 + 1; y2 = y1 + 1; idistx = 256 - distx; idisty = 256 - disty; b = bits + (y1 + dy)*stride; x_off = x1 + dx; x1_out = (x1 < box.x1-dx) | (x1 >= box.x2-dx); x2_out = (x2 < box.x1-dx) | (x2 >= box.x2-dx); y1_out = (y1 < box.y1-dy) | (y1 >= box.y2-dy); y2_out = (y2 < box.y1-dy) | (y2 >= box.y2-dy); tl = x1_out|y1_out ? 0 : fetch(b, x_off, indexed); tr = x2_out|y1_out ? 0 : fetch(b, x_off + 1, indexed); b += stride; bl = x1_out|y2_out ? 0 : fetch(b, x_off, indexed); br = x2_out|y2_out ? 0 : fetch(b, x_off + 1, indexed); ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; r = (((ft * idisty + fb * disty) >> 16) & 0xff); ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; r |= (((ft * idisty + fb * disty)) & 0xff0000); ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); WRITE(buffer + i, r); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } else { for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off; FbBits *b; CARD32 tl, tr, bl, br, r; CARD32 ft, fb; if (!affine) { xFixed_48_16 div; div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; x1 = div >> 16; distx = ((xFixed)div >> 8) & 0xff; div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; y1 = div >> 16; disty = ((xFixed)div >> 8) & 0xff; } else { x1 = v.vector[0] >> 16; distx = (v.vector[0] >> 8) & 0xff; y1 = v.vector[1] >> 16; disty = (v.vector[1] >> 8) & 0xff; } x2 = x1 + 1; y2 = y1 + 1; idistx = 256 - distx; idisty = 256 - disty; b = bits + (y1 + dy)*stride; x_off = x1 + dx; tl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y1 + dy, &box) ? fetch(b, x_off, indexed) : 0; tr = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y1 + dy, &box) ? fetch(b, x_off + 1, indexed) : 0; b += stride; bl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y2 + dy, &box) ? fetch(b, x_off, indexed) : 0; br = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y2 + dy, &box) ? fetch(b, x_off + 1, indexed) : 0; ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; r = (((ft * idisty + fb * disty) >> 16) & 0xff); ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; r |= (((ft * idisty + fb * disty)) & 0xff0000); ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); WRITE(buffer + i, r); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } } else if (pict->filter == PictFilterConvolution) { xFixed *params = pict->filter_params; INT32 cwidth = xFixedToInt(params[0]); INT32 cheight = xFixedToInt(params[1]); int xoff = (params[0] - xFixed1) >> 1; int yoff = (params[1] - xFixed1) >> 1; params += 2; for (i = 0; i < width; ++i) { if (!mask || mask[i] & maskBits) { if (!v.vector[2]) { WRITE(buffer + i, 0); } else { int x1, x2, y1, y2, x, y; INT32 srtot, sgtot, sbtot, satot; xFixed *p = params; if (!affine) { xFixed_48_16 tmp; tmp = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2] - xoff; x1 = xFixedToInt(tmp); tmp = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2] - yoff; y1 = xFixedToInt(tmp); } else { x1 = xFixedToInt(v.vector[0] - xoff); y1 = xFixedToInt(v.vector[1] - yoff); } x2 = x1 + cwidth; y2 = y1 + cheight; srtot = sgtot = sbtot = satot = 0; for (y = y1; y < y2; y++) { int ty = (pict->repeatType == RepeatNormal) ? MOD (y, pict->pDrawable->height) : y; for (x = x1; x < x2; x++) { if (*p) { int tx = (pict->repeatType == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x; if (POINT_IN_REGION (0, pict->pCompositeClip, tx + dx, ty + dy, &box)) { FbBits *b = bits + (ty + dy)*stride; CARD32 c = fetch(b, tx + dx, indexed); srtot += Red(c) * *p; sgtot += Green(c) * *p; sbtot += Blue(c) * *p; satot += Alpha(c) * *p; } } p++; } } satot >>= 16; srtot >>= 16; sgtot >>= 16; sbtot >>= 16; if (satot < 0) satot = 0; else if (satot > 0xff) satot = 0xff; if (srtot < 0) srtot = 0; else if (srtot > 0xff) srtot = 0xff; if (sgtot < 0) sgtot = 0; else if (sgtot > 0xff) sgtot = 0xff; if (sbtot < 0) sbtot = 0; else if (sbtot > 0xff) sbtot = 0xff; WRITE(buffer + i, ((satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot ))); } } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } fbFinishAccess (pict->pDrawable); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,117
fbFetch_a1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = ((CARD32 *)bits)[(i + x) >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = p >> (0x1f - ((i+x) & 0x1f)); #else a = p >> ((i+x) & 0x1f); #endif a = a & 1; a |= a << 1; a |= a << 2; a |= a << 4; WRITE(buffer++, a << 24); } }
DoS Exec Code Mem. Corr.
0
fbFetch_a1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = ((CARD32 *)bits)[(i + x) >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = p >> (0x1f - ((i+x) & 0x1f)); #else a = p >> ((i+x) & 0x1f); #endif a = a & 1; a |= a << 1; a |= a << 2; a |= a << 4; WRITE(buffer++, a << 24); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,118
fbFetch_a1b5g5r5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b, a; a = (CARD32) ((CARD8) (0 - ((p & 0x8000) >> 15))) << 24; b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7; g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; WRITE(buffer++, (a | r | g | b)); } }
DoS Exec Code Mem. Corr.
0
fbFetch_a1b5g5r5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b, a; a = (CARD32) ((CARD8) (0 - ((p & 0x8000) >> 15))) << 24; b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7; g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; WRITE(buffer++, (a | r | g | b)); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,119
fbFetch_a1r1g1b1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); CARD32 a,r,g,b; a = ((p & 0x8) * 0xff) << 21; r = ((p & 0x4) * 0xff) << 14; g = ((p & 0x2) * 0xff) << 7; b = ((p & 0x1) * 0xff); WRITE(buffer++, a|r|g|b); } }
DoS Exec Code Mem. Corr.
0
fbFetch_a1r1g1b1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); CARD32 a,r,g,b; a = ((p & 0x8) * 0xff) << 21; r = ((p & 0x4) * 0xff) << 14; g = ((p & 0x2) * 0xff) << 7; b = ((p & 0x1) * 0xff); WRITE(buffer++, a|r|g|b); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,120
fbFetch_a1r5g5b5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b, a; a = (CARD32) ((CARD8) (0 - ((p & 0x8000) >> 15))) << 24; r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9; g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2; WRITE(buffer++, (a | r | g | b)); } }
DoS Exec Code Mem. Corr.
0
fbFetch_a1r5g5b5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b, a; a = (CARD32) ((CARD8) (0 - ((p & 0x8000) >> 15))) << 24; r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9; g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2; WRITE(buffer++, (a | r | g | b)); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,121
fbFetch_a2b2g2r2 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 a,r,g,b; a = ((p & 0xc0) * 0x55) << 18; b = ((p & 0x30) * 0x55) >> 6; g = ((p & 0x0c) * 0x55) << 6; r = ((p & 0x03) * 0x55) << 16; WRITE(buffer++, a|r|g|b); } }
DoS Exec Code Mem. Corr.
0
fbFetch_a2b2g2r2 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 a,r,g,b; a = ((p & 0xc0) * 0x55) << 18; b = ((p & 0x30) * 0x55) >> 6; g = ((p & 0x0c) * 0x55) << 6; r = ((p & 0x03) * 0x55) << 16; WRITE(buffer++, a|r|g|b); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,122
fbFetch_a4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); p |= p << 4; WRITE(buffer++, p << 24); } }
DoS Exec Code Mem. Corr.
0
fbFetch_a4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); p |= p << 4; WRITE(buffer++, p << 24); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,123
fbFetch_a4b4g4r4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b, a; a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16; b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4; g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16; WRITE(buffer++, (a | r | g | b)); } }
DoS Exec Code Mem. Corr.
0
fbFetch_a4b4g4r4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b, a; a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16; b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4; g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16; WRITE(buffer++, (a | r | g | b)); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,124
fbFetch_a4r4g4b4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b, a; a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16; r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; b = ((p & 0x000f) | ((p & 0x000f) << 4)); WRITE(buffer++, (a | r | g | b)); } }
DoS Exec Code Mem. Corr.
0
fbFetch_a4r4g4b4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b, a; a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16; r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; b = ((p & 0x000f) | ((p & 0x000f) << 4)); WRITE(buffer++, (a | r | g | b)); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,125
fbFetch_a8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { WRITE(buffer++, READ(pixel++) << 24); } }
DoS Exec Code Mem. Corr.
0
fbFetch_a8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { WRITE(buffer++, READ(pixel++) << 24); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,126
fbFetch_b1g2r1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); CARD32 r,g,b; b = ((p & 0x8) * 0xff) >> 3; g = ((p & 0x6) * 0x55) << 7; r = ((p & 0x1) * 0xff) << 16; WRITE(buffer++, 0xff000000|r|g|b); } }
DoS Exec Code Mem. Corr.
0
fbFetch_b1g2r1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); CARD32 r,g,b; b = ((p & 0x8) * 0xff) >> 3; g = ((p & 0x6) * 0x55) << 7; r = ((p & 0x1) * 0xff) << 16; WRITE(buffer++, 0xff000000|r|g|b); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,127
fbFetch_b2g3r3 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b; b = (((p & 0xc0) ) | ((p & 0xc0) >> 2) | ((p & 0xc0) >> 4) | ((p & 0xc0) >> 6)); g = ((p & 0x38) | ((p & 0x38) >> 3) | ((p & 0x30) << 2)) << 8; r = (((p & 0x07) ) | ((p & 0x07) << 3) | ((p & 0x06) << 6)) << 16; WRITE(buffer++, (0xff000000 | r | g | b)); } }
DoS Exec Code Mem. Corr.
0
fbFetch_b2g3r3 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b; b = (((p & 0xc0) ) | ((p & 0xc0) >> 2) | ((p & 0xc0) >> 4) | ((p & 0xc0) >> 6)); g = ((p & 0x38) | ((p & 0x38) >> 3) | ((p & 0x30) << 2)) << 8; r = (((p & 0x07) ) | ((p & 0x07) << 3) | ((p & 0x06) << 6)) << 16; WRITE(buffer++, (0xff000000 | r | g | b)); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,128
fbFetch_b5g6r5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b; b = ((p & 0xf800) | ((p & 0xe000) >> 5)) >> 8; g = ((p & 0x07e0) | ((p & 0x0600) >> 6)) << 5; r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; WRITE(buffer++, (0xff000000 | r | g | b)); } }
DoS Exec Code Mem. Corr.
0
fbFetch_b5g6r5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b; b = ((p & 0xf800) | ((p & 0xe000) >> 5)) >> 8; g = ((p & 0x07e0) | ((p & 0x0600) >> 6)) << 5; r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; WRITE(buffer++, (0xff000000 | r | g | b)); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,129
fbFetch_b8g8r8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + 3*x; const CARD8 *end = pixel + 3*width; while (pixel < end) { CARD32 b = 0xff000000; #if IMAGE_BYTE_ORDER == MSBFirst b |= (READ(pixel++)); b |= (READ(pixel++) << 8); b |= (READ(pixel++) << 16); #else b |= (READ(pixel++) << 16); b |= (READ(pixel++) << 8); b |= (READ(pixel++)); #endif } }
DoS Exec Code Mem. Corr.
0
fbFetch_b8g8r8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + 3*x; const CARD8 *end = pixel + 3*width; while (pixel < end) { CARD32 b = 0xff000000; #if IMAGE_BYTE_ORDER == MSBFirst b |= (READ(pixel++)); b |= (READ(pixel++) << 8); b |= (READ(pixel++) << 16); #else b |= (READ(pixel++) << 16); b |= (READ(pixel++) << 8); b |= (READ(pixel++)); #endif } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,130
fbFetch_c4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); WRITE(buffer++, indexed->rgba[p]); } }
DoS Exec Code Mem. Corr.
0
fbFetch_c4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); WRITE(buffer++, indexed->rgba[p]); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,131
fbFetch_c8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); WRITE(buffer++, indexed->rgba[p]); } }
DoS Exec Code Mem. Corr.
0
fbFetch_c8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); WRITE(buffer++, indexed->rgba[p]); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,132
fbFetch_g1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = ((CARD32 *)bits)[(i+x) >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = p >> (0x1f - ((i+x) & 0x1f)); #else a = p >> ((i+x) & 0x1f); #endif a = a & 1; WRITE(buffer++, indexed->rgba[a]); } }
DoS Exec Code Mem. Corr.
0
fbFetch_g1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = ((CARD32 *)bits)[(i+x) >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = p >> (0x1f - ((i+x) & 0x1f)); #else a = p >> ((i+x) & 0x1f); #endif a = a & 1; WRITE(buffer++, indexed->rgba[a]); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,133
fbFetch_r1g2b1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); CARD32 r,g,b; r = ((p & 0x8) * 0xff) << 13; g = ((p & 0x6) * 0x55) << 7; b = ((p & 0x1) * 0xff); WRITE(buffer++, 0xff000000|r|g|b); } }
DoS Exec Code Mem. Corr.
0
fbFetch_r1g2b1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); CARD32 r,g,b; r = ((p & 0x8) * 0xff) << 13; g = ((p & 0x6) * 0x55) << 7; b = ((p & 0x1) * 0xff); WRITE(buffer++, 0xff000000|r|g|b); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,134
fbFetch_r3g3b2 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b; r = ((p & 0xe0) | ((p & 0xe0) >> 3) | ((p & 0xc0) >> 6)) << 16; g = ((p & 0x1c) | ((p & 0x18) >> 3) | ((p & 0x1c) << 3)) << 8; b = (((p & 0x03) ) | ((p & 0x03) << 2) | ((p & 0x03) << 4) | ((p & 0x03) << 6)); WRITE(buffer++, (0xff000000 | r | g | b)); } }
DoS Exec Code Mem. Corr.
0
fbFetch_r3g3b2 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b; r = ((p & 0xe0) | ((p & 0xe0) >> 3) | ((p & 0xc0) >> 6)) << 16; g = ((p & 0x1c) | ((p & 0x18) >> 3) | ((p & 0x1c) << 3)) << 8; b = (((p & 0x03) ) | ((p & 0x03) << 2) | ((p & 0x03) << 4) | ((p & 0x03) << 6)); WRITE(buffer++, (0xff000000 | r | g | b)); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,135
fbFetch_r5g6b5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r = (((p) << 3) & 0xf8) | (((p) << 5) & 0xfc00) | (((p) << 8) & 0xf80000); r |= (r >> 5) & 0x70007; r |= (r >> 6) & 0x300; WRITE(buffer++, 0xff000000 | r); } }
DoS Exec Code Mem. Corr.
0
fbFetch_r5g6b5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r = (((p) << 3) & 0xf8) | (((p) << 5) & 0xfc00) | (((p) << 8) & 0xf80000); r |= (r >> 5) & 0x70007; r |= (r >> 6) & 0x300; WRITE(buffer++, 0xff000000 | r); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,136
fbFetch_r8g8b8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + 3*x; const CARD8 *end = pixel + 3*width; while (pixel < end) { CARD32 b = Fetch24(pixel) | 0xff000000; pixel += 3; WRITE(buffer++, b); } }
DoS Exec Code Mem. Corr.
0
fbFetch_r8g8b8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + 3*x; const CARD8 *end = pixel + 3*width; while (pixel < end) { CARD32 b = Fetch24(pixel) | 0xff000000; pixel += 3; WRITE(buffer++, b); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,137
fbFetch_x1r5g5b5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b; r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9; g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2; WRITE(buffer++, (0xff000000 | r | g | b)); } }
DoS Exec Code Mem. Corr.
0
fbFetch_x1r5g5b5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b; r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9; g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2; WRITE(buffer++, (0xff000000 | r | g | b)); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,138
fbFetch_x4b4g4r4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b; b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4; g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16; WRITE(buffer++, (0xff000000 | r | g | b)); } }
DoS Exec Code Mem. Corr.
0
fbFetch_x4b4g4r4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b; b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4; g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16; WRITE(buffer++, (0xff000000 | r | g | b)); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,139
fbFetch_x4r4g4b4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b; r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; b = ((p & 0x000f) | ((p & 0x000f) << 4)); WRITE(buffer++, (0xff000000 | r | g | b)); } }
DoS Exec Code Mem. Corr.
0
fbFetch_x4r4g4b4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = READ(pixel++); CARD32 r,g,b; r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; b = ((p & 0x000f) | ((p & 0x000f) << 4)); WRITE(buffer++, (0xff000000 | r | g | b)); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,140
fbFetch_x8r8g8b8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD32 *pixel = (const CARD32 *)bits + x; const CARD32 *end = pixel + width; while (pixel < end) { WRITE(buffer++, READ(pixel++) | 0xff000000); } }
DoS Exec Code Mem. Corr.
0
fbFetch_x8r8g8b8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD32 *pixel = (const CARD32 *)bits + x; const CARD32 *end = pixel + width; while (pixel < end) { WRITE(buffer++, READ(pixel++) | 0xff000000); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,141
static void fbStore(PicturePtr pict, int x, int y, int width, CARD32 *buffer) { FbBits *bits; FbStride stride; int bpp; int xoff, yoff; storeProc store = storeProcForPicture(pict); miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); x += xoff; y += yoff; bits += y*stride; store(bits, buffer, x, width, indexed); fbFinishAccess (pict->pDrawable); }
DoS Exec Code Mem. Corr.
0
static void fbStore(PicturePtr pict, int x, int y, int width, CARD32 *buffer) { FbBits *bits; FbStride stride; int bpp; int xoff, yoff; storeProc store = storeProcForPicture(pict); miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); x += xoff; y += yoff; bits += y*stride; store(bits, buffer, x, width, indexed); fbFinishAccess (pict->pDrawable); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,142
static void fbStoreExternalAlpha(PicturePtr pict, int x, int y, int width, CARD32 *buffer) { FbBits *bits, *alpha_bits; FbStride stride, astride; int bpp, abpp; int xoff, yoff; int ax, ay; storeProc store; storeProc astore; miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; miIndexedPtr aindexed; if (!pict->alphaMap) { fbStore(pict, x, y, width, buffer); return; } store = storeProcForPicture(pict); astore = storeProcForPicture(pict->alphaMap); aindexed = (miIndexedPtr) pict->alphaMap->pFormat->index.devPrivate; ax = x; ay = y; fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); x += xoff; y += yoff; fbGetDrawable (pict->alphaMap->pDrawable, alpha_bits, astride, abpp, xoff, yoff); ax += xoff; ay += yoff; bits += y*stride; alpha_bits += (ay - pict->alphaOrigin.y)*astride; store(bits, buffer, x, width, indexed); astore(alpha_bits, buffer, ax - pict->alphaOrigin.x, width, aindexed); fbFinishAccess (pict->alphaMap->pDrawable); fbFinishAccess (pict->pDrawable); }
DoS Exec Code Mem. Corr.
0
static void fbStoreExternalAlpha(PicturePtr pict, int x, int y, int width, CARD32 *buffer) { FbBits *bits, *alpha_bits; FbStride stride, astride; int bpp, abpp; int xoff, yoff; int ax, ay; storeProc store; storeProc astore; miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; miIndexedPtr aindexed; if (!pict->alphaMap) { fbStore(pict, x, y, width, buffer); return; } store = storeProcForPicture(pict); astore = storeProcForPicture(pict->alphaMap); aindexed = (miIndexedPtr) pict->alphaMap->pFormat->index.devPrivate; ax = x; ay = y; fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); x += xoff; y += yoff; fbGetDrawable (pict->alphaMap->pDrawable, alpha_bits, astride, abpp, xoff, yoff); ax += xoff; ay += yoff; bits += y*stride; alpha_bits += (ay - pict->alphaOrigin.y)*astride; store(bits, buffer, x, width, indexed); astore(alpha_bits, buffer, ax - pict->alphaOrigin.x, width, aindexed); fbFinishAccess (pict->alphaMap->pDrawable); fbFinishAccess (pict->pDrawable); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,143
fbStore_a1b1g1r1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 pixel; Splita(READ(values + i)); pixel = (((a >> 4) & 0x8) | ((b >> 5) & 0x4) | ((g >> 6) & 0x2) | ((r >> 7) )); Store4(bits, i + x, pixel); } }
DoS Exec Code Mem. Corr.
0
fbStore_a1b1g1r1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 pixel; Splita(READ(values + i)); pixel = (((a >> 4) & 0x8) | ((b >> 5) & 0x4) | ((g >> 6) & 0x2) | ((r >> 7) )); Store4(bits, i + x, pixel); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,144
fbStore_a1b5g5r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(READ(values + i)); WRITE(pixel++, ((a << 8) & 0x8000) | ((b << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((r >> 3) )); } }
DoS Exec Code Mem. Corr.
0
fbStore_a1b5g5r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(READ(values + i)); WRITE(pixel++, ((a << 8) & 0x8000) | ((b << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((r >> 3) )); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,145
fbStore_a1r1g1b1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 pixel; Splita(READ(values + i)); pixel = (((a >> 4) & 0x8) | ((r >> 5) & 0x4) | ((g >> 6) & 0x2) | ((b >> 7) )); Store4(bits, i + x, pixel); } }
DoS Exec Code Mem. Corr.
0
fbStore_a1r1g1b1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 pixel; Splita(READ(values + i)); pixel = (((a >> 4) & 0x8) | ((r >> 5) & 0x4) | ((g >> 6) & 0x2) | ((b >> 7) )); Store4(bits, i + x, pixel); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,146
fbStore_a1r5g5b5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(READ(values + i)); WRITE(pixel++, ((a << 8) & 0x8000) | ((r << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((b >> 3) )); } }
DoS Exec Code Mem. Corr.
0
fbStore_a1r5g5b5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(READ(values + i)); WRITE(pixel++, ((a << 8) & 0x8000) | ((r << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((b >> 3) )); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,147
fbStore_a2r2g2b2 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { Splita(READ(values + i)); WRITE(pixel++, ((a ) & 0xc0) | ((r >> 2) & 0x30) | ((g >> 4) & 0x0c) | ((b >> 6) )); } }
DoS Exec Code Mem. Corr.
0
fbStore_a2r2g2b2 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { Splita(READ(values + i)); WRITE(pixel++, ((a ) & 0xc0) | ((r >> 2) & 0x30) | ((g >> 4) & 0x0c) | ((b >> 6) )); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,148
fbStore_a4b4g4r4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(READ(values + i)); WRITE(pixel++, ((a << 8) & 0xf000) | ((b << 4) & 0x0f00) | ((g ) & 0x00f0) | ((r >> 4) )); } }
DoS Exec Code Mem. Corr.
0
fbStore_a4b4g4r4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(READ(values + i)); WRITE(pixel++, ((a << 8) & 0xf000) | ((b << 4) & 0x0f00) | ((g ) & 0x00f0) | ((r >> 4) )); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,149
fbStore_a4r4g4b4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(READ(values + i)); WRITE(pixel++, ((a << 8) & 0xf000) | ((r << 4) & 0x0f00) | ((g ) & 0x00f0) | ((b >> 4) )); } }
DoS Exec Code Mem. Corr.
0
fbStore_a4r4g4b4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(READ(values + i)); WRITE(pixel++, ((a << 8) & 0xf000) | ((r << 4) & 0x0f00) | ((g ) & 0x00f0) | ((b >> 4) )); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,150
fbStore_a8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { WRITE(pixel++, READ(values + i) >> 24); } }
DoS Exec Code Mem. Corr.
0
fbStore_a8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { WRITE(pixel++, READ(values + i) >> 24); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,151
fbStore_a8b8g8r8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD32 *pixel = (CARD32 *)bits + x; for (i = 0; i < width; ++i) WRITE(pixel++, (READ(values + i) & 0xff00ff00) | ((READ(values + i) >> 16) & 0xff) | ((READ(values + i) & 0xff) << 16)); }
DoS Exec Code Mem. Corr.
0
fbStore_a8b8g8r8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD32 *pixel = (CARD32 *)bits + x; for (i = 0; i < width; ++i) WRITE(pixel++, (READ(values + i) & 0xff00ff00) | ((READ(values + i) >> 16) & 0xff) | ((READ(values + i) & 0xff) << 16)); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,152
fbStore_a8r8g8b8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { MEMCPY_WRAPPED(((CARD32 *)bits) + x, values, width*sizeof(CARD32)); }
DoS Exec Code Mem. Corr.
0
fbStore_a8r8g8b8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { MEMCPY_WRAPPED(((CARD32 *)bits) + x, values, width*sizeof(CARD32)); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,153
fbStore_b2g3r3 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((b ) & 0xe0) | ((g >> 3) & 0x1c) | ((r >> 6) )); } }
DoS Exec Code Mem. Corr.
0
fbStore_b2g3r3 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((b ) & 0xe0) | ((g >> 3) & 0x1c) | ((r >> 6) )); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,154
fbStore_b5g6r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((b << 8) & 0xf800) | ((g << 3) & 0x07e0) | ((r >> 3) )); } }
DoS Exec Code Mem. Corr.
0
fbStore_b5g6r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((b << 8) & 0xf800) | ((g << 3) & 0x07e0) | ((r >> 3) )); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,155
fbStore_c4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 pixel; pixel = miIndexToEnt24(indexed, READ(values + i)); Store4(bits, i + x, pixel); } }
DoS Exec Code Mem. Corr.
0
fbStore_c4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 pixel; pixel = miIndexToEnt24(indexed, READ(values + i)); Store4(bits, i + x, pixel); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,156
fbStore_c8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { WRITE(pixel++, miIndexToEnt24(indexed,READ(values + i))); } }
DoS Exec Code Mem. Corr.
0
fbStore_c8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { WRITE(pixel++, miIndexToEnt24(indexed,READ(values + i))); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,157
fbStore_g1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 *pixel = ((CARD32 *) bits) + ((i+x) >> 5); CARD32 mask = FbStipMask((i+x) & 0x1f, 1); CARD32 v = miIndexToEntY24(indexed,READ(values + i)) ? mask : 0; WRITE(pixel, (READ(pixel) & ~mask) | v); } }
DoS Exec Code Mem. Corr.
0
fbStore_g1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 *pixel = ((CARD32 *) bits) + ((i+x) >> 5); CARD32 mask = FbStipMask((i+x) & 0x1f, 1); CARD32 v = miIndexToEntY24(indexed,READ(values + i)) ? mask : 0; WRITE(pixel, (READ(pixel) & ~mask) | v); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,158
fbStore_r3g3b2 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((r ) & 0xe0) | ((g >> 3) & 0x1c) | ((b >> 6) )); } }
DoS Exec Code Mem. Corr.
0
fbStore_r3g3b2 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((r ) & 0xe0) | ((g >> 3) & 0x1c) | ((b >> 6) )); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,159
fbStore_r8g8b8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + 3*x; for (i = 0; i < width; ++i) { Store24(pixel, READ(values + i)); pixel += 3; } }
DoS Exec Code Mem. Corr.
0
fbStore_r8g8b8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + 3*x; for (i = 0; i < width; ++i) { Store24(pixel, READ(values + i)); pixel += 3; } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,160
fbStore_x1b5g5r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((b << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((r >> 3) )); } }
DoS Exec Code Mem. Corr.
0
fbStore_x1b5g5r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((b << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((r >> 3) )); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,161
fbStore_x4a4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { WRITE(pixel++, READ(values + i) >> 28); } }
DoS Exec Code Mem. Corr.
0
fbStore_x4a4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { WRITE(pixel++, READ(values + i) >> 28); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,162
fbStore_x4b4g4r4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((b << 4) & 0x0f00) | ((g ) & 0x00f0) | ((r >> 4) )); } }
DoS Exec Code Mem. Corr.
0
fbStore_x4b4g4r4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((b << 4) & 0x0f00) | ((g ) & 0x00f0) | ((r >> 4) )); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,163
fbStore_x4r4g4b4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((r << 4) & 0x0f00) | ((g ) & 0x00f0) | ((b >> 4) )); } }
DoS Exec Code Mem. Corr.
0
fbStore_x4r4g4b4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((r << 4) & 0x0f00) | ((g ) & 0x00f0) | ((b >> 4) )); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,164
fbStore_x8b8g8r8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD32 *pixel = (CARD32 *)bits + x; for (i = 0; i < width; ++i) WRITE(pixel++, (READ(values + i) & 0x0000ff00) | ((READ(values + i) >> 16) & 0xff) | ((READ(values + i) & 0xff) << 16)); }
DoS Exec Code Mem. Corr.
0
fbStore_x8b8g8r8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD32 *pixel = (CARD32 *)bits + x; for (i = 0; i < width; ++i) WRITE(pixel++, (READ(values + i) & 0x0000ff00) | ((READ(values + i) >> 16) & 0xff) | ((READ(values + i) & 0xff) << 16)); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,165
static fetchProc fetchProcForPicture (PicturePtr pict) { switch(pict->format) { case PICT_a8r8g8b8: return fbFetch_a8r8g8b8; case PICT_x8r8g8b8: return fbFetch_x8r8g8b8; case PICT_a8b8g8r8: return fbFetch_a8b8g8r8; case PICT_x8b8g8r8: return fbFetch_x8b8g8r8; /* 24bpp formats */ case PICT_r8g8b8: return fbFetch_r8g8b8; case PICT_b8g8r8: return fbFetch_b8g8r8; /* 16bpp formats */ case PICT_r5g6b5: return fbFetch_r5g6b5; case PICT_b5g6r5: return fbFetch_b5g6r5; case PICT_a1r5g5b5: return fbFetch_a1r5g5b5; case PICT_x1r5g5b5: return fbFetch_x1r5g5b5; case PICT_a1b5g5r5: return fbFetch_a1b5g5r5; case PICT_x1b5g5r5: return fbFetch_x1b5g5r5; case PICT_a4r4g4b4: return fbFetch_a4r4g4b4; case PICT_x4r4g4b4: return fbFetch_x4r4g4b4; case PICT_a4b4g4r4: return fbFetch_a4b4g4r4; case PICT_x4b4g4r4: return fbFetch_x4b4g4r4; /* 8bpp formats */ case PICT_a8: return fbFetch_a8; case PICT_r3g3b2: return fbFetch_r3g3b2; case PICT_b2g3r3: return fbFetch_b2g3r3; case PICT_a2r2g2b2: return fbFetch_a2r2g2b2; case PICT_a2b2g2r2: return fbFetch_a2b2g2r2; case PICT_c8: return fbFetch_c8; case PICT_g8: return fbFetch_c8; case PICT_x4a4: return fbFetch_x4a4; /* 4bpp formats */ case PICT_a4: return fbFetch_a4; case PICT_r1g2b1: return fbFetch_r1g2b1; case PICT_b1g2r1: return fbFetch_b1g2r1; case PICT_a1r1g1b1: return fbFetch_a1r1g1b1; case PICT_a1b1g1r1: return fbFetch_a1b1g1r1; case PICT_c4: return fbFetch_c4; case PICT_g4: return fbFetch_c4; /* 1bpp formats */ case PICT_a1: return fbFetch_a1; case PICT_g1: return fbFetch_g1; } return NULL; }
DoS Exec Code Mem. Corr.
0
static fetchProc fetchProcForPicture (PicturePtr pict) { switch(pict->format) { case PICT_a8r8g8b8: return fbFetch_a8r8g8b8; case PICT_x8r8g8b8: return fbFetch_x8r8g8b8; case PICT_a8b8g8r8: return fbFetch_a8b8g8r8; case PICT_x8b8g8r8: return fbFetch_x8b8g8r8; /* 24bpp formats */ case PICT_r8g8b8: return fbFetch_r8g8b8; case PICT_b8g8r8: return fbFetch_b8g8r8; /* 16bpp formats */ case PICT_r5g6b5: return fbFetch_r5g6b5; case PICT_b5g6r5: return fbFetch_b5g6r5; case PICT_a1r5g5b5: return fbFetch_a1r5g5b5; case PICT_x1r5g5b5: return fbFetch_x1r5g5b5; case PICT_a1b5g5r5: return fbFetch_a1b5g5r5; case PICT_x1b5g5r5: return fbFetch_x1b5g5r5; case PICT_a4r4g4b4: return fbFetch_a4r4g4b4; case PICT_x4r4g4b4: return fbFetch_x4r4g4b4; case PICT_a4b4g4r4: return fbFetch_a4b4g4r4; case PICT_x4b4g4r4: return fbFetch_x4b4g4r4; /* 8bpp formats */ case PICT_a8: return fbFetch_a8; case PICT_r3g3b2: return fbFetch_r3g3b2; case PICT_b2g3r3: return fbFetch_b2g3r3; case PICT_a2r2g2b2: return fbFetch_a2r2g2b2; case PICT_a2b2g2r2: return fbFetch_a2b2g2r2; case PICT_c8: return fbFetch_c8; case PICT_g8: return fbFetch_c8; case PICT_x4a4: return fbFetch_x4a4; /* 4bpp formats */ case PICT_a4: return fbFetch_a4; case PICT_r1g2b1: return fbFetch_r1g2b1; case PICT_b1g2r1: return fbFetch_b1g2r1; case PICT_a1r1g1b1: return fbFetch_a1r1g1b1; case PICT_a1b1g1r1: return fbFetch_a1b1g1r1; case PICT_c4: return fbFetch_c4; case PICT_g4: return fbFetch_c4; /* 1bpp formats */ case PICT_a1: return fbFetch_a1; case PICT_g1: return fbFetch_g1; } return NULL; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,166
static storeProc storeProcForPicture (PicturePtr pict) { switch(pict->format) { case PICT_a8r8g8b8: return fbStore_a8r8g8b8; case PICT_x8r8g8b8: return fbStore_x8r8g8b8; case PICT_a8b8g8r8: return fbStore_a8b8g8r8; case PICT_x8b8g8r8: return fbStore_x8b8g8r8; /* 24bpp formats */ case PICT_r8g8b8: return fbStore_r8g8b8; case PICT_b8g8r8: return fbStore_b8g8r8; /* 16bpp formats */ case PICT_r5g6b5: return fbStore_r5g6b5; case PICT_b5g6r5: return fbStore_b5g6r5; case PICT_a1r5g5b5: return fbStore_a1r5g5b5; case PICT_x1r5g5b5: return fbStore_x1r5g5b5; case PICT_a1b5g5r5: return fbStore_a1b5g5r5; case PICT_x1b5g5r5: return fbStore_x1b5g5r5; case PICT_a4r4g4b4: return fbStore_a4r4g4b4; case PICT_x4r4g4b4: return fbStore_x4r4g4b4; case PICT_a4b4g4r4: return fbStore_a4b4g4r4; case PICT_x4b4g4r4: return fbStore_x4b4g4r4; /* 8bpp formats */ case PICT_a8: return fbStore_a8; case PICT_r3g3b2: return fbStore_r3g3b2; case PICT_b2g3r3: return fbStore_b2g3r3; case PICT_a2r2g2b2: return fbStore_a2r2g2b2; case PICT_c8: return fbStore_c8; case PICT_g8: return fbStore_c8; case PICT_x4a4: return fbStore_x4a4; /* 4bpp formats */ case PICT_a4: return fbStore_a4; case PICT_r1g2b1: return fbStore_r1g2b1; case PICT_b1g2r1: return fbStore_b1g2r1; case PICT_a1r1g1b1: return fbStore_a1r1g1b1; case PICT_a1b1g1r1: return fbStore_a1b1g1r1; case PICT_c4: return fbStore_c4; case PICT_g4: return fbStore_c4; /* 1bpp formats */ case PICT_a1: return fbStore_a1; case PICT_g1: return fbStore_g1; default: return NULL; } }
DoS Exec Code Mem. Corr.
0
static storeProc storeProcForPicture (PicturePtr pict) { switch(pict->format) { case PICT_a8r8g8b8: return fbStore_a8r8g8b8; case PICT_x8r8g8b8: return fbStore_x8r8g8b8; case PICT_a8b8g8r8: return fbStore_a8b8g8r8; case PICT_x8b8g8r8: return fbStore_x8b8g8r8; /* 24bpp formats */ case PICT_r8g8b8: return fbStore_r8g8b8; case PICT_b8g8r8: return fbStore_b8g8r8; /* 16bpp formats */ case PICT_r5g6b5: return fbStore_r5g6b5; case PICT_b5g6r5: return fbStore_b5g6r5; case PICT_a1r5g5b5: return fbStore_a1r5g5b5; case PICT_x1r5g5b5: return fbStore_x1r5g5b5; case PICT_a1b5g5r5: return fbStore_a1b5g5r5; case PICT_x1b5g5r5: return fbStore_x1b5g5r5; case PICT_a4r4g4b4: return fbStore_a4r4g4b4; case PICT_x4r4g4b4: return fbStore_x4r4g4b4; case PICT_a4b4g4r4: return fbStore_a4b4g4r4; case PICT_x4b4g4r4: return fbStore_x4b4g4r4; /* 8bpp formats */ case PICT_a8: return fbStore_a8; case PICT_r3g3b2: return fbStore_r3g3b2; case PICT_b2g3r3: return fbStore_b2g3r3; case PICT_a2r2g2b2: return fbStore_a2r2g2b2; case PICT_c8: return fbStore_c8; case PICT_g8: return fbStore_c8; case PICT_x4a4: return fbStore_x4a4; /* 4bpp formats */ case PICT_a4: return fbStore_a4; case PICT_r1g2b1: return fbStore_r1g2b1; case PICT_b1g2r1: return fbStore_b1g2r1; case PICT_a1r1g1b1: return fbStore_a1r1g1b1; case PICT_a1b1g1r1: return fbStore_a1b1g1r1; case PICT_c4: return fbStore_c4; case PICT_g4: return fbStore_c4; /* 1bpp formats */ case PICT_a1: return fbStore_a1; case PICT_g1: return fbStore_g1; default: return NULL; } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,167
int acquire_terminal(const char *name, bool fail, bool force, bool ignore_tiocstty_eperm) { int fd = -1, notify = -1, r, wd = -1; assert(name); /* We use inotify to be notified when the tty is closed. We * create the watch before checking if we can actually acquire * it, so that we don't lose any event. * * Note: strictly speaking this actually watches for the * device being closed, it does *not* really watch whether a * tty loses its controlling process. However, unless some * rogue process uses TIOCNOTTY on /dev/tty *after* closing * its tty otherwise this will not become a problem. As long * as the administrator makes sure not configure any service * on the same tty as an untrusted user this should not be a * problem. (Which he probably should not do anyway.) */ if (!fail && !force) { if ((notify = inotify_init1(IN_CLOEXEC)) < 0) { r = -errno; goto fail; } if ((wd = inotify_add_watch(notify, name, IN_CLOSE)) < 0) { r = -errno; goto fail; } } for (;;) { if (notify >= 0) if ((r = flush_fd(notify)) < 0) goto fail; /* We pass here O_NOCTTY only so that we can check the return * value TIOCSCTTY and have a reliable way to figure out if we * successfully became the controlling process of the tty */ if ((fd = open_terminal(name, O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0) return fd; /* First, try to get the tty */ r = ioctl(fd, TIOCSCTTY, force); /* Sometimes it makes sense to ignore TIOCSCTTY * returning EPERM, i.e. when very likely we already * are have this controlling terminal. */ if (r < 0 && errno == EPERM && ignore_tiocstty_eperm) r = 0; if (r < 0 && (force || fail || errno != EPERM)) { r = -errno; goto fail; } if (r >= 0) break; assert(!fail); assert(!force); assert(notify >= 0); for (;;) { uint8_t inotify_buffer[sizeof(struct inotify_event) + FILENAME_MAX]; ssize_t l; struct inotify_event *e; if ((l = read(notify, inotify_buffer, sizeof(inotify_buffer))) < 0) { if (errno == EINTR) continue; r = -errno; goto fail; } e = (struct inotify_event*) inotify_buffer; while (l > 0) { size_t step; if (e->wd != wd || !(e->mask & IN_CLOSE)) { r = -EIO; goto fail; } step = sizeof(struct inotify_event) + e->len; assert(step <= (size_t) l); e = (struct inotify_event*) ((uint8_t*) e + step); l -= step; } break; } /* We close the tty fd here since if the old session * ended our handle will be dead. It's important that * we do this after sleeping, so that we don't enter * an endless loop. */ close_nointr_nofail(fd); } if (notify >= 0) close_nointr_nofail(notify); r = reset_terminal_fd(fd, true); if (r < 0) log_warning("Failed to reset terminal: %s", strerror(-r)); return fd; fail: if (fd >= 0) close_nointr_nofail(fd); if (notify >= 0) close_nointr_nofail(notify); return r; }
null
0
int acquire_terminal(const char *name, bool fail, bool force, bool ignore_tiocstty_eperm) { int fd = -1, notify = -1, r, wd = -1; assert(name); /* We use inotify to be notified when the tty is closed. We * create the watch before checking if we can actually acquire * it, so that we don't lose any event. * * Note: strictly speaking this actually watches for the * device being closed, it does *not* really watch whether a * tty loses its controlling process. However, unless some * rogue process uses TIOCNOTTY on /dev/tty *after* closing * its tty otherwise this will not become a problem. As long * as the administrator makes sure not configure any service * on the same tty as an untrusted user this should not be a * problem. (Which he probably should not do anyway.) */ if (!fail && !force) { if ((notify = inotify_init1(IN_CLOEXEC)) < 0) { r = -errno; goto fail; } if ((wd = inotify_add_watch(notify, name, IN_CLOSE)) < 0) { r = -errno; goto fail; } } for (;;) { if (notify >= 0) if ((r = flush_fd(notify)) < 0) goto fail; /* We pass here O_NOCTTY only so that we can check the return * value TIOCSCTTY and have a reliable way to figure out if we * successfully became the controlling process of the tty */ if ((fd = open_terminal(name, O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0) return fd; /* First, try to get the tty */ r = ioctl(fd, TIOCSCTTY, force); /* Sometimes it makes sense to ignore TIOCSCTTY * returning EPERM, i.e. when very likely we already * are have this controlling terminal. */ if (r < 0 && errno == EPERM && ignore_tiocstty_eperm) r = 0; if (r < 0 && (force || fail || errno != EPERM)) { r = -errno; goto fail; } if (r >= 0) break; assert(!fail); assert(!force); assert(notify >= 0); for (;;) { uint8_t inotify_buffer[sizeof(struct inotify_event) + FILENAME_MAX]; ssize_t l; struct inotify_event *e; if ((l = read(notify, inotify_buffer, sizeof(inotify_buffer))) < 0) { if (errno == EINTR) continue; r = -errno; goto fail; } e = (struct inotify_event*) inotify_buffer; while (l > 0) { size_t step; if (e->wd != wd || !(e->mask & IN_CLOSE)) { r = -EIO; goto fail; } step = sizeof(struct inotify_event) + e->len; assert(step <= (size_t) l); e = (struct inotify_event*) ((uint8_t*) e + step); l -= step; } break; } /* We close the tty fd here since if the old session * ended our handle will be dead. It's important that * we do this after sleeping, so that we don't enter * an endless loop. */ close_nointr_nofail(fd); } if (notify >= 0) close_nointr_nofail(notify); r = reset_terminal_fd(fd, true); if (r < 0) log_warning("Failed to reset terminal: %s", strerror(-r)); return fd; fail: if (fd >= 0) close_nointr_nofail(fd); if (notify >= 0) close_nointr_nofail(notify); return r; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,168
int ask(char *ret, const char *replies, const char *text, ...) { bool on_tty; assert(ret); assert(replies); assert(text); on_tty = isatty(STDOUT_FILENO); for (;;) { va_list ap; char c; int r; bool need_nl = true; if (on_tty) fputs(ANSI_HIGHLIGHT_ON, stdout); va_start(ap, text); vprintf(text, ap); va_end(ap); if (on_tty) fputs(ANSI_HIGHLIGHT_OFF, stdout); fflush(stdout); r = read_one_char(stdin, &c, (usec_t) -1, &need_nl); if (r < 0) { if (r == -EBADMSG) { puts("Bad input, please try again."); continue; } putchar('\n'); return r; } if (need_nl) putchar('\n'); if (strchr(replies, c)) { *ret = c; return 0; } puts("Read unexpected character, please try again."); } }
null
0
int ask(char *ret, const char *replies, const char *text, ...) { bool on_tty; assert(ret); assert(replies); assert(text); on_tty = isatty(STDOUT_FILENO); for (;;) { va_list ap; char c; int r; bool need_nl = true; if (on_tty) fputs(ANSI_HIGHLIGHT_ON, stdout); va_start(ap, text); vprintf(text, ap); va_end(ap); if (on_tty) fputs(ANSI_HIGHLIGHT_OFF, stdout); fflush(stdout); r = read_one_char(stdin, &c, (usec_t) -1, &need_nl); if (r < 0) { if (r == -EBADMSG) { puts("Bad input, please try again."); continue; } putchar('\n'); return r; } if (need_nl) putchar('\n'); if (strchr(replies, c)) { *ret = c; return 0; } puts("Read unexpected character, please try again."); } }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,169
char *bus_path_escape(const char *s) { char *r, *t; const char *f; assert(s); /* Escapes all chars that D-Bus' object path cannot deal * with. Can be reverse with bus_path_unescape() */ if (!(r = new(char, strlen(s)*3+1))) return NULL; for (f = s, t = r; *f; f++) { if (!(*f >= 'A' && *f <= 'Z') && !(*f >= 'a' && *f <= 'z') && !(*f >= '0' && *f <= '9')) { *(t++) = '_'; *(t++) = hexchar(*f >> 4); *(t++) = hexchar(*f); } else *(t++) = *f; } *t = 0; return r; }
null
0
char *bus_path_escape(const char *s) { char *r, *t; const char *f; assert(s); /* Escapes all chars that D-Bus' object path cannot deal * with. Can be reverse with bus_path_unescape() */ if (!(r = new(char, strlen(s)*3+1))) return NULL; for (f = s, t = r; *f; f++) { if (!(*f >= 'A' && *f <= 'Z') && !(*f >= 'a' && *f <= 'z') && !(*f >= '0' && *f <= '9')) { *(t++) = '_'; *(t++) = hexchar(*f >> 4); *(t++) = hexchar(*f); } else *(t++) = *f; } *t = 0; return r; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,170
char *bus_path_unescape(const char *f) { char *r, *t; assert(f); if (!(r = strdup(f))) return NULL; for (t = r; *f; f++) { if (*f == '_') { int a, b; if ((a = unhexchar(f[1])) < 0 || (b = unhexchar(f[2])) < 0) { /* Invalid escape code, let's take it literal then */ *(t++) = '_'; } else { *(t++) = (char) ((a << 4) | b); f += 2; } } else *(t++) = *f; } *t = 0; return r; }
null
0
char *bus_path_unescape(const char *f) { char *r, *t; assert(f); if (!(r = strdup(f))) return NULL; for (t = r; *f; f++) { if (*f == '_') { int a, b; if ((a = unhexchar(f[1])) < 0 || (b = unhexchar(f[2])) < 0) { /* Invalid escape code, let's take it literal then */ *(t++) = '_'; } else { *(t++) = (char) ((a << 4) | b); f += 2; } } else *(t++) = *f; } *t = 0; return r; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,171
char *cescape(const char *s) { char *r, *t; const char *f; assert(s); /* Does C style string escaping. */ if (!(r = new(char, strlen(s)*4 + 1))) return NULL; for (f = s, t = r; *f; f++) switch (*f) { case '\a': *(t++) = '\\'; *(t++) = 'a'; break; case '\b': *(t++) = '\\'; *(t++) = 'b'; break; case '\f': *(t++) = '\\'; *(t++) = 'f'; break; case '\n': *(t++) = '\\'; *(t++) = 'n'; break; case '\r': *(t++) = '\\'; *(t++) = 'r'; break; case '\t': *(t++) = '\\'; *(t++) = 't'; break; case '\v': *(t++) = '\\'; *(t++) = 'v'; break; case '\\': *(t++) = '\\'; *(t++) = '\\'; break; case '"': *(t++) = '\\'; *(t++) = '"'; break; case '\'': *(t++) = '\\'; *(t++) = '\''; break; default: /* For special chars we prefer octal over * hexadecimal encoding, simply because glib's * g_strescape() does the same */ if ((*f < ' ') || (*f >= 127)) { *(t++) = '\\'; *(t++) = octchar((unsigned char) *f >> 6); *(t++) = octchar((unsigned char) *f >> 3); *(t++) = octchar((unsigned char) *f); } else *(t++) = *f; break; } *t = 0; return r; }
null
0
char *cescape(const char *s) { char *r, *t; const char *f; assert(s); /* Does C style string escaping. */ if (!(r = new(char, strlen(s)*4 + 1))) return NULL; for (f = s, t = r; *f; f++) switch (*f) { case '\a': *(t++) = '\\'; *(t++) = 'a'; break; case '\b': *(t++) = '\\'; *(t++) = 'b'; break; case '\f': *(t++) = '\\'; *(t++) = 'f'; break; case '\n': *(t++) = '\\'; *(t++) = 'n'; break; case '\r': *(t++) = '\\'; *(t++) = 'r'; break; case '\t': *(t++) = '\\'; *(t++) = 't'; break; case '\v': *(t++) = '\\'; *(t++) = 'v'; break; case '\\': *(t++) = '\\'; *(t++) = '\\'; break; case '"': *(t++) = '\\'; *(t++) = '"'; break; case '\'': *(t++) = '\\'; *(t++) = '\''; break; default: /* For special chars we prefer octal over * hexadecimal encoding, simply because glib's * g_strescape() does the same */ if ((*f < ' ') || (*f >= 127)) { *(t++) = '\\'; *(t++) = octchar((unsigned char) *f >> 6); *(t++) = octchar((unsigned char) *f >> 3); *(t++) = octchar((unsigned char) *f); } else *(t++) = *f; break; } *t = 0; return r; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,172
bool chars_intersect(const char *a, const char *b) { const char *p; /* Returns true if any of the chars in a are in b. */ for (p = a; *p; p++) if (strchr(b, *p)) return true; return false; }
null
0
bool chars_intersect(const char *a, const char *b) { const char *p; /* Returns true if any of the chars in a are in b. */ for (p = a; *p; p++) if (strchr(b, *p)) return true; return false; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,173
int chvt(int vt) { int fd, r = 0; if ((fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0) return -errno; if (vt < 0) { int tiocl[2] = { TIOCL_GETKMSGREDIRECT, 0 }; if (ioctl(fd, TIOCLINUX, tiocl) < 0) { r = -errno; goto fail; } vt = tiocl[0] <= 0 ? 1 : tiocl[0]; } if (ioctl(fd, VT_ACTIVATE, vt) < 0) r = -errno; fail: close_nointr_nofail(fd); return r; }
null
0
int chvt(int vt) { int fd, r = 0; if ((fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0) return -errno; if (vt < 0) { int tiocl[2] = { TIOCL_GETKMSGREDIRECT, 0 }; if (ioctl(fd, TIOCLINUX, tiocl) < 0) { r = -errno; goto fail; } vt = tiocl[0] <= 0 ? 1 : tiocl[0]; } if (ioctl(fd, VT_ACTIVATE, vt) < 0) r = -errno; fail: close_nointr_nofail(fd); return r; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,174
int close_all_fds(const int except[], unsigned n_except) { DIR *d; struct dirent *de; int r = 0; assert(n_except == 0 || except); d = opendir("/proc/self/fd"); if (!d) { int fd; struct rlimit rl; /* When /proc isn't available (for example in chroots) * the fallback is brute forcing through the fd * table */ assert_se(getrlimit(RLIMIT_NOFILE, &rl) >= 0); for (fd = 3; fd < (int) rl.rlim_max; fd ++) { if (fd_in_set(fd, except, n_except)) continue; if (close_nointr(fd) < 0) if (errno != EBADF && r == 0) r = -errno; } return r; } while ((de = readdir(d))) { int fd = -1; if (ignore_file(de->d_name)) continue; if (safe_atoi(de->d_name, &fd) < 0) /* Let's better ignore this, just in case */ continue; if (fd < 3) continue; if (fd == dirfd(d)) continue; if (fd_in_set(fd, except, n_except)) continue; if (close_nointr(fd) < 0) { /* Valgrind has its own FD and doesn't want to have it closed */ if (errno != EBADF && r == 0) r = -errno; } } closedir(d); return r; }
null
0
int close_all_fds(const int except[], unsigned n_except) { DIR *d; struct dirent *de; int r = 0; assert(n_except == 0 || except); d = opendir("/proc/self/fd"); if (!d) { int fd; struct rlimit rl; /* When /proc isn't available (for example in chroots) * the fallback is brute forcing through the fd * table */ assert_se(getrlimit(RLIMIT_NOFILE, &rl) >= 0); for (fd = 3; fd < (int) rl.rlim_max; fd ++) { if (fd_in_set(fd, except, n_except)) continue; if (close_nointr(fd) < 0) if (errno != EBADF && r == 0) r = -errno; } return r; } while ((de = readdir(d))) { int fd = -1; if (ignore_file(de->d_name)) continue; if (safe_atoi(de->d_name, &fd) < 0) /* Let's better ignore this, just in case */ continue; if (fd < 3) continue; if (fd == dirfd(d)) continue; if (fd_in_set(fd, except, n_except)) continue; if (close_nointr(fd) < 0) { /* Valgrind has its own FD and doesn't want to have it closed */ if (errno != EBADF && r == 0) r = -errno; } } closedir(d); return r; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,175
int close_nointr(int fd) { assert(fd >= 0); for (;;) { int r; r = close(fd); if (r >= 0) return r; if (errno != EINTR) return -errno; } }
null
0
int close_nointr(int fd) { assert(fd >= 0); for (;;) { int r; r = close(fd); if (r >= 0) return r; if (errno != EINTR) return -errno; } }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,176
void close_nointr_nofail(int fd) { int saved_errno = errno; /* like close_nointr() but cannot fail, and guarantees errno * is unchanged */ assert_se(close_nointr(fd) == 0); errno = saved_errno; }
null
0
void close_nointr_nofail(int fd) { int saved_errno = errno; /* like close_nointr() but cannot fail, and guarantees errno * is unchanged */ assert_se(close_nointr(fd) == 0); errno = saved_errno; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,177
int close_pipe(int p[]) { int a = 0, b = 0; assert(p); if (p[0] >= 0) { a = close_nointr(p[0]); p[0] = -1; } if (p[1] >= 0) { b = close_nointr(p[1]); p[1] = -1; } return a < 0 ? a : b; }
null
0
int close_pipe(int p[]) { int a = 0, b = 0; assert(p); if (p[0] >= 0) { a = close_nointr(p[0]); p[0] = -1; } if (p[1] >= 0) { b = close_nointr(p[1]); p[1] = -1; } return a < 0 ? a : b; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,178
char *cunescape(const char *s) { return cunescape_length(s, strlen(s)); }
null
0
char *cunescape(const char *s) { return cunescape_length(s, strlen(s)); }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,179
char *cunescape_length(const char *s, size_t length) { char *r, *t; const char *f; assert(s); /* Undoes C style string escaping */ r = new(char, length+1); if (!r) return r; for (f = s, t = r; f < s + length; f++) { if (*f != '\\') { *(t++) = *f; continue; } f++; switch (*f) { case 'a': *(t++) = '\a'; break; case 'b': *(t++) = '\b'; break; case 'f': *(t++) = '\f'; break; case 'n': *(t++) = '\n'; break; case 'r': *(t++) = '\r'; break; case 't': *(t++) = '\t'; break; case 'v': *(t++) = '\v'; break; case '\\': *(t++) = '\\'; break; case '"': *(t++) = '"'; break; case '\'': *(t++) = '\''; break; case 's': /* This is an extension of the XDG syntax files */ *(t++) = ' '; break; case 'x': { /* hexadecimal encoding */ int a, b; a = unhexchar(f[1]); b = unhexchar(f[2]); if (a < 0 || b < 0) { /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = 'x'; } else { *(t++) = (char) ((a << 4) | b); f += 2; } break; } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': { /* octal encoding */ int a, b, c; a = unoctchar(f[0]); b = unoctchar(f[1]); c = unoctchar(f[2]); if (a < 0 || b < 0 || c < 0) { /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = f[0]; } else { *(t++) = (char) ((a << 6) | (b << 3) | c); f += 2; } break; } case 0: /* premature end of string.*/ *(t++) = '\\'; goto finish; default: /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = *f; break; } } finish: *t = 0; return r; }
null
0
char *cunescape_length(const char *s, size_t length) { char *r, *t; const char *f; assert(s); /* Undoes C style string escaping */ r = new(char, length+1); if (!r) return r; for (f = s, t = r; f < s + length; f++) { if (*f != '\\') { *(t++) = *f; continue; } f++; switch (*f) { case 'a': *(t++) = '\a'; break; case 'b': *(t++) = '\b'; break; case 'f': *(t++) = '\f'; break; case 'n': *(t++) = '\n'; break; case 'r': *(t++) = '\r'; break; case 't': *(t++) = '\t'; break; case 'v': *(t++) = '\v'; break; case '\\': *(t++) = '\\'; break; case '"': *(t++) = '"'; break; case '\'': *(t++) = '\''; break; case 's': /* This is an extension of the XDG syntax files */ *(t++) = ' '; break; case 'x': { /* hexadecimal encoding */ int a, b; a = unhexchar(f[1]); b = unhexchar(f[2]); if (a < 0 || b < 0) { /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = 'x'; } else { *(t++) = (char) ((a << 4) | b); f += 2; } break; } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': { /* octal encoding */ int a, b, c; a = unoctchar(f[0]); b = unoctchar(f[1]); c = unoctchar(f[2]); if (a < 0 || b < 0 || c < 0) { /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = f[0]; } else { *(t++) = (char) ((a << 6) | (b << 3) | c); f += 2; } break; } case 0: /* premature end of string.*/ *(t++) = '\\'; goto finish; default: /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = *f; break; } } finish: *t = 0; return r; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,180
char decchar(int x) { return '0' + (x % 10); }
null
0
char decchar(int x) { return '0' + (x % 10); }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,181
int default_signals(int sig, ...) { struct sigaction sa; va_list ap; int r = 0; zero(sa); sa.sa_handler = SIG_DFL; sa.sa_flags = SA_RESTART; if (sigaction(sig, &sa, NULL) < 0) r = -errno; va_start(ap, sig); while ((sig = va_arg(ap, int)) > 0) if (sigaction(sig, &sa, NULL) < 0) r = -errno; va_end(ap); return r; }
null
0
int default_signals(int sig, ...) { struct sigaction sa; va_list ap; int r = 0; zero(sa); sa.sa_handler = SIG_DFL; sa.sa_flags = SA_RESTART; if (sigaction(sig, &sa, NULL) < 0) r = -errno; va_start(ap, sig); while ((sig = va_arg(ap, int)) > 0) if (sigaction(sig, &sa, NULL) < 0) r = -errno; va_end(ap); return r; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,182
char *delete_chars(char *s, const char *bad) { char *f, *t; /* Drops all whitespace, regardless where in the string */ for (f = s, t = s; *f; f++) { if (strchr(bad, *f)) continue; *(t++) = *f; } *t = 0; return s; }
null
0
char *delete_chars(char *s, const char *bad) { char *f, *t; /* Drops all whitespace, regardless where in the string */ for (f = s, t = s; *f; f++) { if (strchr(bad, *f)) continue; *(t++) = *f; } *t = 0; return s; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,183
dual_timestamp* dual_timestamp_get(dual_timestamp *ts) { assert(ts); ts->realtime = now(CLOCK_REALTIME); ts->monotonic = now(CLOCK_MONOTONIC); return ts; }
null
0
dual_timestamp* dual_timestamp_get(dual_timestamp *ts) { assert(ts); ts->realtime = now(CLOCK_REALTIME); ts->monotonic = now(CLOCK_MONOTONIC); return ts; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,184
int fd_cloexec(int fd, bool cloexec) { int flags; assert(fd >= 0); if ((flags = fcntl(fd, F_GETFD, 0)) < 0) return -errno; if (cloexec) flags |= FD_CLOEXEC; else flags &= ~FD_CLOEXEC; if (fcntl(fd, F_SETFD, flags) < 0) return -errno; return 0; }
null
0
int fd_cloexec(int fd, bool cloexec) { int flags; assert(fd >= 0); if ((flags = fcntl(fd, F_GETFD, 0)) < 0) return -errno; if (cloexec) flags |= FD_CLOEXEC; else flags &= ~FD_CLOEXEC; if (fcntl(fd, F_SETFD, flags) < 0) return -errno; return 0; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,185
static bool fd_in_set(int fd, const int fdset[], unsigned n_fdset) { unsigned i; assert(n_fdset == 0 || fdset); for (i = 0; i < n_fdset; i++) if (fdset[i] == fd) return true; return false; }
null
0
static bool fd_in_set(int fd, const int fdset[], unsigned n_fdset) { unsigned i; assert(n_fdset == 0 || fdset); for (i = 0; i < n_fdset; i++) if (fdset[i] == fd) return true; return false; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,186
char *file_in_same_dir(const char *path, const char *filename) { char *e, *r; size_t k; assert(path); assert(filename); /* This removes the last component of path and appends * filename, unless the latter is absolute anyway or the * former isn't */ if (path_is_absolute(filename)) return strdup(filename); if (!(e = strrchr(path, '/'))) return strdup(filename); k = strlen(filename); if (!(r = new(char, e-path+1+k+1))) return NULL; memcpy(r, path, e-path+1); memcpy(r+(e-path)+1, filename, k+1); return r; }
null
0
char *file_in_same_dir(const char *path, const char *filename) { char *e, *r; size_t k; assert(path); assert(filename); /* This removes the last component of path and appends * filename, unless the latter is absolute anyway or the * former isn't */ if (path_is_absolute(filename)) return strdup(filename); if (!(e = strrchr(path, '/'))) return strdup(filename); k = strlen(filename); if (!(r = new(char, e-path+1+k+1))) return NULL; memcpy(r, path, e-path+1); memcpy(r+(e-path)+1, filename, k+1); return r; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,187
char *file_name_from_path(const char *p) { char *r; assert(p); if ((r = strrchr(p, '/'))) return r + 1; return (char*) p; }
null
0
char *file_name_from_path(const char *p) { char *r; assert(p); if ((r = strrchr(p, '/'))) return r + 1; return (char*) p; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,188
bool first_word(const char *s, const char *word) { size_t sl, wl; assert(s); assert(word); sl = strlen(s); wl = strlen(word); if (sl < wl) return false; if (wl == 0) return true; if (memcmp(s, word, wl) != 0) return false; return s[wl] == 0 || strchr(WHITESPACE, s[wl]); }
null
0
bool first_word(const char *s, const char *word) { size_t sl, wl; assert(s); assert(word); sl = strlen(s); wl = strlen(word); if (sl < wl) return false; if (wl == 0) return true; if (memcmp(s, word, wl) != 0) return false; return s[wl] == 0 || strchr(WHITESPACE, s[wl]); }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,189
char *format_timespan(char *buf, size_t l, usec_t t) { static const struct { const char *suffix; usec_t usec; } table[] = { { "w", USEC_PER_WEEK }, { "d", USEC_PER_DAY }, { "h", USEC_PER_HOUR }, { "min", USEC_PER_MINUTE }, { "s", USEC_PER_SEC }, { "ms", USEC_PER_MSEC }, { "us", 1 }, }; unsigned i; char *p = buf; assert(buf); assert(l > 0); if (t == (usec_t) -1) return NULL; if (t == 0) { snprintf(p, l, "0"); p[l-1] = 0; return p; } /* The result of this function can be parsed with parse_usec */ for (i = 0; i < ELEMENTSOF(table); i++) { int k; size_t n; if (t < table[i].usec) continue; if (l <= 1) break; k = snprintf(p, l, "%s%llu%s", p > buf ? " " : "", (unsigned long long) (t / table[i].usec), table[i].suffix); n = MIN((size_t) k, l); l -= n; p += n; t %= table[i].usec; } *p = 0; return buf; }
null
0
char *format_timespan(char *buf, size_t l, usec_t t) { static const struct { const char *suffix; usec_t usec; } table[] = { { "w", USEC_PER_WEEK }, { "d", USEC_PER_DAY }, { "h", USEC_PER_HOUR }, { "min", USEC_PER_MINUTE }, { "s", USEC_PER_SEC }, { "ms", USEC_PER_MSEC }, { "us", 1 }, }; unsigned i; char *p = buf; assert(buf); assert(l > 0); if (t == (usec_t) -1) return NULL; if (t == 0) { snprintf(p, l, "0"); p[l-1] = 0; return p; } /* The result of this function can be parsed with parse_usec */ for (i = 0; i < ELEMENTSOF(table); i++) { int k; size_t n; if (t < table[i].usec) continue; if (l <= 1) break; k = snprintf(p, l, "%s%llu%s", p > buf ? " " : "", (unsigned long long) (t / table[i].usec), table[i].suffix); n = MIN((size_t) k, l); l -= n; p += n; t %= table[i].usec; } *p = 0; return buf; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,190
char *format_timestamp_pretty(char *buf, size_t l, usec_t t) { usec_t n, d; n = now(CLOCK_REALTIME); if (t <= 0 || t > n || t + USEC_PER_DAY*7 <= t) return NULL; d = n - t; if (d >= USEC_PER_YEAR) snprintf(buf, l, "%llu years and %llu months ago", (unsigned long long) (d / USEC_PER_YEAR), (unsigned long long) ((d % USEC_PER_YEAR) / USEC_PER_MONTH)); else if (d >= USEC_PER_MONTH) snprintf(buf, l, "%llu months and %llu days ago", (unsigned long long) (d / USEC_PER_MONTH), (unsigned long long) ((d % USEC_PER_MONTH) / USEC_PER_DAY)); else if (d >= USEC_PER_WEEK) snprintf(buf, l, "%llu weeks and %llu days ago", (unsigned long long) (d / USEC_PER_WEEK), (unsigned long long) ((d % USEC_PER_WEEK) / USEC_PER_DAY)); else if (d >= 2*USEC_PER_DAY) snprintf(buf, l, "%llu days ago", (unsigned long long) (d / USEC_PER_DAY)); else if (d >= 25*USEC_PER_HOUR) snprintf(buf, l, "1 day and %lluh ago", (unsigned long long) ((d - USEC_PER_DAY) / USEC_PER_HOUR)); else if (d >= 6*USEC_PER_HOUR) snprintf(buf, l, "%lluh ago", (unsigned long long) (d / USEC_PER_HOUR)); else if (d >= USEC_PER_HOUR) snprintf(buf, l, "%lluh %llumin ago", (unsigned long long) (d / USEC_PER_HOUR), (unsigned long long) ((d % USEC_PER_HOUR) / USEC_PER_MINUTE)); else if (d >= 5*USEC_PER_MINUTE) snprintf(buf, l, "%llumin ago", (unsigned long long) (d / USEC_PER_MINUTE)); else if (d >= USEC_PER_MINUTE) snprintf(buf, l, "%llumin %llus ago", (unsigned long long) (d / USEC_PER_MINUTE), (unsigned long long) ((d % USEC_PER_MINUTE) / USEC_PER_SEC)); else if (d >= USEC_PER_SEC) snprintf(buf, l, "%llus ago", (unsigned long long) (d / USEC_PER_SEC)); else if (d >= USEC_PER_MSEC) snprintf(buf, l, "%llums ago", (unsigned long long) (d / USEC_PER_MSEC)); else if (d > 0) snprintf(buf, l, "%lluus ago", (unsigned long long) d); else snprintf(buf, l, "now"); buf[l-1] = 0; return buf; }
null
0
char *format_timestamp_pretty(char *buf, size_t l, usec_t t) { usec_t n, d; n = now(CLOCK_REALTIME); if (t <= 0 || t > n || t + USEC_PER_DAY*7 <= t) return NULL; d = n - t; if (d >= USEC_PER_YEAR) snprintf(buf, l, "%llu years and %llu months ago", (unsigned long long) (d / USEC_PER_YEAR), (unsigned long long) ((d % USEC_PER_YEAR) / USEC_PER_MONTH)); else if (d >= USEC_PER_MONTH) snprintf(buf, l, "%llu months and %llu days ago", (unsigned long long) (d / USEC_PER_MONTH), (unsigned long long) ((d % USEC_PER_MONTH) / USEC_PER_DAY)); else if (d >= USEC_PER_WEEK) snprintf(buf, l, "%llu weeks and %llu days ago", (unsigned long long) (d / USEC_PER_WEEK), (unsigned long long) ((d % USEC_PER_WEEK) / USEC_PER_DAY)); else if (d >= 2*USEC_PER_DAY) snprintf(buf, l, "%llu days ago", (unsigned long long) (d / USEC_PER_DAY)); else if (d >= 25*USEC_PER_HOUR) snprintf(buf, l, "1 day and %lluh ago", (unsigned long long) ((d - USEC_PER_DAY) / USEC_PER_HOUR)); else if (d >= 6*USEC_PER_HOUR) snprintf(buf, l, "%lluh ago", (unsigned long long) (d / USEC_PER_HOUR)); else if (d >= USEC_PER_HOUR) snprintf(buf, l, "%lluh %llumin ago", (unsigned long long) (d / USEC_PER_HOUR), (unsigned long long) ((d % USEC_PER_HOUR) / USEC_PER_MINUTE)); else if (d >= 5*USEC_PER_MINUTE) snprintf(buf, l, "%llumin ago", (unsigned long long) (d / USEC_PER_MINUTE)); else if (d >= USEC_PER_MINUTE) snprintf(buf, l, "%llumin %llus ago", (unsigned long long) (d / USEC_PER_MINUTE), (unsigned long long) ((d % USEC_PER_MINUTE) / USEC_PER_SEC)); else if (d >= USEC_PER_SEC) snprintf(buf, l, "%llus ago", (unsigned long long) (d / USEC_PER_SEC)); else if (d >= USEC_PER_MSEC) snprintf(buf, l, "%llums ago", (unsigned long long) (d / USEC_PER_MSEC)); else if (d > 0) snprintf(buf, l, "%lluus ago", (unsigned long long) d); else snprintf(buf, l, "now"); buf[l-1] = 0; return buf; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,191
bool fstype_is_network(const char *fstype) { static const char * const table[] = { "cifs", "smbfs", "ncpfs", "nfs", "nfs4", "gfs", "gfs2" }; unsigned i; for (i = 0; i < ELEMENTSOF(table); i++) if (streq(table[i], fstype)) return true; return false; }
null
0
bool fstype_is_network(const char *fstype) { static const char * const table[] = { "cifs", "smbfs", "ncpfs", "nfs", "nfs4", "gfs", "gfs2" }; unsigned i; for (i = 0; i < ELEMENTSOF(table); i++) if (streq(table[i], fstype)) return true; return false; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,192
int get_ctty(pid_t pid, dev_t *_devnr, char **r) { int k; char fn[PATH_MAX], *s, *b, *p; dev_t devnr; assert(r); k = get_ctty_devnr(pid, &devnr); if (k < 0) return k; snprintf(fn, sizeof(fn), "/dev/char/%u:%u", major(devnr), minor(devnr)); char_array_0(fn); if ((k = readlink_malloc(fn, &s)) < 0) { if (k != -ENOENT) return k; /* This is an ugly hack */ if (major(devnr) == 136) { if (asprintf(&b, "pts/%lu", (unsigned long) minor(devnr)) < 0) return -ENOMEM; *r = b; if (_devnr) *_devnr = devnr; return 0; } /* Probably something like the ptys which have no * symlink in /dev/char. Let's return something * vaguely useful. */ if (!(b = strdup(fn + 5))) return -ENOMEM; *r = b; if (_devnr) *_devnr = devnr; return 0; } if (startswith(s, "/dev/")) p = s + 5; else if (startswith(s, "../")) p = s + 3; else p = s; b = strdup(p); free(s); if (!b) return -ENOMEM; *r = b; if (_devnr) *_devnr = devnr; return 0; }
null
0
int get_ctty(pid_t pid, dev_t *_devnr, char **r) { int k; char fn[PATH_MAX], *s, *b, *p; dev_t devnr; assert(r); k = get_ctty_devnr(pid, &devnr); if (k < 0) return k; snprintf(fn, sizeof(fn), "/dev/char/%u:%u", major(devnr), minor(devnr)); char_array_0(fn); if ((k = readlink_malloc(fn, &s)) < 0) { if (k != -ENOENT) return k; /* This is an ugly hack */ if (major(devnr) == 136) { if (asprintf(&b, "pts/%lu", (unsigned long) minor(devnr)) < 0) return -ENOMEM; *r = b; if (_devnr) *_devnr = devnr; return 0; } /* Probably something like the ptys which have no * symlink in /dev/char. Let's return something * vaguely useful. */ if (!(b = strdup(fn + 5))) return -ENOMEM; *r = b; if (_devnr) *_devnr = devnr; return 0; } if (startswith(s, "/dev/")) p = s + 5; else if (startswith(s, "../")) p = s + 3; else p = s; b = strdup(p); free(s); if (!b) return -ENOMEM; *r = b; if (_devnr) *_devnr = devnr; return 0; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,193
int get_ctty_devnr(pid_t pid, dev_t *d) { int k; char line[LINE_MAX], *p, *fn; unsigned long ttynr; FILE *f; if (asprintf(&fn, "/proc/%lu/stat", (unsigned long) (pid <= 0 ? getpid() : pid)) < 0) return -ENOMEM; f = fopen(fn, "re"); free(fn); if (!f) return -errno; if (!fgets(line, sizeof(line), f)) { k = feof(f) ? -EIO : -errno; fclose(f); return k; } fclose(f); p = strrchr(line, ')'); if (!p) return -EIO; p++; if (sscanf(p, " " "%*c " /* state */ "%*d " /* ppid */ "%*d " /* pgrp */ "%*d " /* session */ "%lu ", /* ttynr */ &ttynr) != 1) return -EIO; *d = (dev_t) ttynr; return 0; }
null
0
int get_ctty_devnr(pid_t pid, dev_t *d) { int k; char line[LINE_MAX], *p, *fn; unsigned long ttynr; FILE *f; if (asprintf(&fn, "/proc/%lu/stat", (unsigned long) (pid <= 0 ? getpid() : pid)) < 0) return -ENOMEM; f = fopen(fn, "re"); free(fn); if (!f) return -errno; if (!fgets(line, sizeof(line), f)) { k = feof(f) ? -EIO : -errno; fclose(f); return k; } fclose(f); p = strrchr(line, ')'); if (!p) return -EIO; p++; if (sscanf(p, " " "%*c " /* state */ "%*d " /* ppid */ "%*d " /* pgrp */ "%*d " /* session */ "%lu ", /* ttynr */ &ttynr) != 1) return -EIO; *d = (dev_t) ttynr; return 0; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,194
int get_parent_of_pid(pid_t pid, pid_t *_ppid) { int r; FILE *f; char fn[PATH_MAX], line[LINE_MAX], *p; long unsigned ppid; assert(pid > 0); assert(_ppid); assert_se(snprintf(fn, sizeof(fn)-1, "/proc/%lu/stat", (unsigned long) pid) < (int) (sizeof(fn)-1)); char_array_0(fn); if (!(f = fopen(fn, "re"))) return -errno; if (!(fgets(line, sizeof(line), f))) { r = feof(f) ? -EIO : -errno; fclose(f); return r; } fclose(f); /* Let's skip the pid and comm fields. The latter is enclosed * in () but does not escape any () in its value, so let's * skip over it manually */ if (!(p = strrchr(line, ')'))) return -EIO; p++; if (sscanf(p, " " "%*c " /* state */ "%lu ", /* ppid */ &ppid) != 1) return -EIO; if ((long unsigned) (pid_t) ppid != ppid) return -ERANGE; *_ppid = (pid_t) ppid; return 0; }
null
0
int get_parent_of_pid(pid_t pid, pid_t *_ppid) { int r; FILE *f; char fn[PATH_MAX], line[LINE_MAX], *p; long unsigned ppid; assert(pid > 0); assert(_ppid); assert_se(snprintf(fn, sizeof(fn)-1, "/proc/%lu/stat", (unsigned long) pid) < (int) (sizeof(fn)-1)); char_array_0(fn); if (!(f = fopen(fn, "re"))) return -errno; if (!(fgets(line, sizeof(line), f))) { r = feof(f) ? -EIO : -errno; fclose(f); return r; } fclose(f); /* Let's skip the pid and comm fields. The latter is enclosed * in () but does not escape any () in its value, so let's * skip over it manually */ if (!(p = strrchr(line, ')'))) return -EIO; p++; if (sscanf(p, " " "%*c " /* state */ "%lu ", /* ppid */ &ppid) != 1) return -EIO; if ((long unsigned) (pid_t) ppid != ppid) return -ERANGE; *_ppid = (pid_t) ppid; return 0; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,195
int get_process_uid(pid_t pid, uid_t *uid) { char *p; FILE *f; int r; assert(uid); if (pid == 0) return getuid(); if (asprintf(&p, "/proc/%lu/status", (unsigned long) pid) < 0) return -ENOMEM; f = fopen(p, "re"); free(p); if (!f) return -errno; while (!feof(f)) { char line[LINE_MAX], *l; if (!fgets(line, sizeof(line), f)) { if (feof(f)) break; r = -errno; goto finish; } l = strstrip(line); if (startswith(l, "Uid:")) { l += 4; l += strspn(l, WHITESPACE); l[strcspn(l, WHITESPACE)] = 0; r = parse_uid(l, uid); goto finish; } } r = -EIO; finish: fclose(f); return r; }
null
0
int get_process_uid(pid_t pid, uid_t *uid) { char *p; FILE *f; int r; assert(uid); if (pid == 0) return getuid(); if (asprintf(&p, "/proc/%lu/status", (unsigned long) pid) < 0) return -ENOMEM; f = fopen(p, "re"); free(p); if (!f) return -errno; while (!feof(f)) { char line[LINE_MAX], *l; if (!fgets(line, sizeof(line), f)) { if (feof(f)) break; r = -errno; goto finish; } l = strstrip(line); if (startswith(l, "Uid:")) { l += 4; l += strspn(l, WHITESPACE); l[strcspn(l, WHITESPACE)] = 0; r = parse_uid(l, uid); goto finish; } } r = -EIO; finish: fclose(f); return r; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,196
int get_starttime_of_pid(pid_t pid, unsigned long long *st) { int r; FILE *f; char fn[PATH_MAX], line[LINE_MAX], *p; assert(pid > 0); assert(st); assert_se(snprintf(fn, sizeof(fn)-1, "/proc/%lu/stat", (unsigned long) pid) < (int) (sizeof(fn)-1)); char_array_0(fn); if (!(f = fopen(fn, "re"))) return -errno; if (!(fgets(line, sizeof(line), f))) { r = feof(f) ? -EIO : -errno; fclose(f); return r; } fclose(f); /* Let's skip the pid and comm fields. The latter is enclosed * in () but does not escape any () in its value, so let's * skip over it manually */ if (!(p = strrchr(line, ')'))) return -EIO; p++; if (sscanf(p, " " "%*c " /* state */ "%*d " /* ppid */ "%*d " /* pgrp */ "%*d " /* session */ "%*d " /* tty_nr */ "%*d " /* tpgid */ "%*u " /* flags */ "%*u " /* minflt */ "%*u " /* cminflt */ "%*u " /* majflt */ "%*u " /* cmajflt */ "%*u " /* utime */ "%*u " /* stime */ "%*d " /* cutime */ "%*d " /* cstime */ "%*d " /* priority */ "%*d " /* nice */ "%*d " /* num_threads */ "%*d " /* itrealvalue */ "%llu " /* starttime */, st) != 1) return -EIO; return 0; }
null
0
int get_starttime_of_pid(pid_t pid, unsigned long long *st) { int r; FILE *f; char fn[PATH_MAX], line[LINE_MAX], *p; assert(pid > 0); assert(st); assert_se(snprintf(fn, sizeof(fn)-1, "/proc/%lu/stat", (unsigned long) pid) < (int) (sizeof(fn)-1)); char_array_0(fn); if (!(f = fopen(fn, "re"))) return -errno; if (!(fgets(line, sizeof(line), f))) { r = feof(f) ? -EIO : -errno; fclose(f); return r; } fclose(f); /* Let's skip the pid and comm fields. The latter is enclosed * in () but does not escape any () in its value, so let's * skip over it manually */ if (!(p = strrchr(line, ')'))) return -EIO; p++; if (sscanf(p, " " "%*c " /* state */ "%*d " /* ppid */ "%*d " /* pgrp */ "%*d " /* session */ "%*d " /* tty_nr */ "%*d " /* tpgid */ "%*u " /* flags */ "%*u " /* minflt */ "%*u " /* cminflt */ "%*u " /* majflt */ "%*u " /* cmajflt */ "%*u " /* utime */ "%*u " /* stime */ "%*d " /* cutime */ "%*d " /* cstime */ "%*d " /* priority */ "%*d " /* nice */ "%*d " /* num_threads */ "%*d " /* itrealvalue */ "%llu " /* starttime */, st) != 1) return -EIO; return 0; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,197
char* getlogname_malloc(void) { uid_t uid; long bufsize; char *buf, *name; struct passwd pwbuf, *pw = NULL; struct stat st; if (isatty(STDIN_FILENO) && fstat(STDIN_FILENO, &st) >= 0) uid = st.st_uid; else uid = getuid(); /* Shortcut things to avoid NSS lookups */ if (uid == 0) return strdup("root"); if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) <= 0) bufsize = 4096; if (!(buf = malloc(bufsize))) return NULL; if (getpwuid_r(uid, &pwbuf, buf, bufsize, &pw) == 0 && pw) { name = strdup(pw->pw_name); free(buf); return name; } free(buf); if (asprintf(&name, "%lu", (unsigned long) uid) < 0) return NULL; return name; }
null
0
char* getlogname_malloc(void) { uid_t uid; long bufsize; char *buf, *name; struct passwd pwbuf, *pw = NULL; struct stat st; if (isatty(STDIN_FILENO) && fstat(STDIN_FILENO, &st) >= 0) uid = st.st_uid; else uid = getuid(); /* Shortcut things to avoid NSS lookups */ if (uid == 0) return strdup("root"); if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) <= 0) bufsize = 4096; if (!(buf = malloc(bufsize))) return NULL; if (getpwuid_r(uid, &pwbuf, buf, bufsize, &pw) == 0 && pw) { name = strdup(pw->pw_name); free(buf); return name; } free(buf); if (asprintf(&name, "%lu", (unsigned long) uid) < 0) return NULL; return name; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,198
int getttyname_harder(int fd, char **r) { int k; char *s; if ((k = getttyname_malloc(fd, &s)) < 0) return k; if (streq(s, "tty")) { free(s); return get_ctty(0, NULL, r); } *r = s; return 0; }
null
0
int getttyname_harder(int fd, char **r) { int k; char *s; if ((k = getttyname_malloc(fd, &s)) < 0) return k; if (streq(s, "tty")) { free(s); return get_ctty(0, NULL, r); } *r = s; return 0; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null
9,199
char hexchar(int x) { static const char table[16] = "0123456789abcdef"; return table[x & 15]; }
null
0
char hexchar(int x) { static const char table[16] = "0123456789abcdef"; return table[x & 15]; }
@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) { if (is_dir) { int subdir_fd; - if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) { + subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (subdir_fd < 0) { if (ret == 0 && errno != ENOENT) ret = -errno; continue;
CWE-362
null
null