diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkImgGIF.c | 7 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 27de486..6273c69 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -410,6 +410,7 @@ FileReadGIF( * source and not a file. */ + memset(colorMap, 0, MAXCOLORMAPSIZE*4); memset(gifConfPtr, 0, sizeof(GIFImageConfig)); if (fileName == INLINE_DATA_BINARY || fileName == INLINE_DATA_BASE64) { gifConfPtr->fromData = fileName; @@ -592,6 +593,9 @@ FileReadGIF( if (trashBuffer == NULL) { nBytes = fileWidth * fileHeight * 3; trashBuffer = ckalloc(nBytes); + if (trashBuffer) { + memset(trashBuffer, 0, nBytes); + } } /* @@ -678,6 +682,9 @@ FileReadGIF( block.pitch = block.pixelSize * imageWidth; nBytes = block.pitch * imageHeight; block.pixelPtr = ckalloc(nBytes); + if (block.pixelPtr) { + memset(block.pixelPtr, 0, nBytes); + } if (ReadImage(gifConfPtr, interp, block.pixelPtr, chan, imageWidth, imageHeight, colorMap, srcX, srcY, BitSet(buf[8], INTERLACE), diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index fcb6d2f..7fa894c 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -2075,6 +2075,9 @@ ToggleComplexAlphaIfNeeded( */ mPtr->flags &= ~COMPLEX_ALPHA; + if (c == NULL) { + return 0; + } c += 3; /* Start at first alpha byte. */ for (; c < end; c += 4) { if (*c && *c != 255) { |