Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion THIRD_PARTY_README
Original file line number Diff line number Diff line change
Expand Up @@ -2381,7 +2381,7 @@ licenses.

-------------------------------------------------------------------------------

%% This notice is provided with respect to GIFLIB 6.1.2 & libungif 4.1.3,
%% This notice is provided with respect to GIFLIB 6.1.3 & libungif 4.1.3,
which may be included with JRE 8, JDK 8, and OpenJDK 8.

--- begin of LICENSE ---
Expand Down
10 changes: 9 additions & 1 deletion jdk/src/share/native/sun/awt/giflib/dgif_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,15 @@ void DGifDecreaseImageCounter(GifFileType *GifFile) {
GifFreeMapObject(GifFile->SavedImages[GifFile->ImageCount].ImageDesc.ColorMap);
}

// Realloc array according to the new image counter.
// Avoid a dodgy edge casse in reallocarray() */
if (GifFile->ImageCount <= 0) {
free(GifFile->SavedImages);
GifFile->SavedImages = NULL;
GifFile->ImageCount = 0;
return;
}

/* Realloc array according to the new image counter. */
correct_saved_images = (SavedImage *)reallocarray(
GifFile->SavedImages, GifFile->ImageCount, sizeof(SavedImage));
if (correct_saved_images != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion jdk/src/share/native/sun/awt/giflib/gif_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern "C" {

#define GIFLIB_MAJOR 6
#define GIFLIB_MINOR 1
#define GIFLIB_RELEASE 2
#define GIFLIB_RELEASE 3

#define GIF_ERROR 0
#define GIF_OK 1
Expand Down
4 changes: 2 additions & 2 deletions jdk/src/share/native/sun/awt/giflib/gifalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1,
* of table 1. This is very useful if your display is limited to
* 16 colors.
*/
while (ColorIn1->Colors[CrntSlot - 1].Red == 0 &&
while (CrntSlot > 0 && (ColorIn1->Colors[CrntSlot - 1].Red == 0 &&
ColorIn1->Colors[CrntSlot - 1].Green == 0 &&
ColorIn1->Colors[CrntSlot - 1].Blue == 0) {
ColorIn1->Colors[CrntSlot - 1].Blue == 0)) {
CrntSlot--;
}

Expand Down