Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
686d6c69
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
686d6c69
编写于
8月 17, 2016
作者:
A
azvegint
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8155691: Update GIFlib library to the latest up-to-date
Reviewed-by: serb
上级
21789486
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
139 addition
and
19 deletion
+139
-19
src/share/native/sun/awt/giflib/dgif_lib.c
src/share/native/sun/awt/giflib/dgif_lib.c
+15
-5
src/share/native/sun/awt/giflib/gif_lib.h
src/share/native/sun/awt/giflib/gif_lib.h
+4
-1
src/share/native/sun/awt/giflib/gifalloc.c
src/share/native/sun/awt/giflib/gifalloc.c
+14
-13
src/share/native/sun/awt/giflib/openbsd-reallocarray.c
src/share/native/sun/awt/giflib/openbsd-reallocarray.c
+106
-0
未找到文件。
src/share/native/sun/awt/giflib/dgif_lib.c
浏览文件 @
686d6c69
...
...
@@ -114,7 +114,7 @@ DGifOpenFileHandle(int FileHandle, int *Error)
GifFile
->
SavedImages
=
NULL
;
GifFile
->
SColorMap
=
NULL
;
Private
=
(
GifFilePrivateType
*
)
malloc
(
sizeof
(
GifFilePrivateType
));
Private
=
(
GifFilePrivateType
*
)
calloc
(
1
,
sizeof
(
GifFilePrivateType
));
if
(
Private
==
NULL
)
{
if
(
Error
!=
NULL
)
*
Error
=
D_GIF_ERR_NOT_ENOUGH_MEM
;
...
...
@@ -122,6 +122,9 @@ DGifOpenFileHandle(int FileHandle, int *Error)
free
((
char
*
)
GifFile
);
return
NULL
;
}
/*@i1@*/
memset
(
Private
,
'\0'
,
sizeof
(
GifFilePrivateType
));
#ifdef _WIN32
_setmode
(
FileHandle
,
O_BINARY
);
/* Make sure it is in binary mode. */
#endif
/* _WIN32 */
...
...
@@ -197,13 +200,14 @@ DGifOpen(void *userData, InputFunc readFunc, int *Error)
GifFile
->
SavedImages
=
NULL
;
GifFile
->
SColorMap
=
NULL
;
Private
=
(
GifFilePrivateType
*
)
malloc
(
sizeof
(
GifFilePrivateType
));
Private
=
(
GifFilePrivateType
*
)
calloc
(
1
,
sizeof
(
GifFilePrivateType
));
if
(
!
Private
)
{
if
(
Error
!=
NULL
)
*
Error
=
D_GIF_ERR_NOT_ENOUGH_MEM
;
free
((
char
*
)
GifFile
);
return
NULL
;
}
/*@i1@*/
memset
(
Private
,
'\0'
,
sizeof
(
GifFilePrivateType
));
GifFile
->
Private
=
(
void
*
)
Private
;
Private
->
FileHandle
=
0
;
...
...
@@ -417,8 +421,8 @@ DGifGetImageDesc(GifFileType *GifFile)
if
(
GifFile
->
SavedImages
)
{
SavedImage
*
new_saved_images
=
(
SavedImage
*
)
realloc
(
GifFile
->
SavedImages
,
sizeof
(
SavedImage
)
*
(
GifFile
->
ImageCount
+
1
));
(
SavedImage
*
)
realloc
array
(
GifFile
->
SavedImages
,
(
GifFile
->
ImageCount
+
1
),
sizeof
(
SavedImage
));
if
(
new_saved_images
==
NULL
)
{
GifFile
->
Error
=
D_GIF_ERR_NOT_ENOUGH_MEM
;
return
GIF_ERROR
;
...
...
@@ -788,6 +792,12 @@ DGifSetupDecompress(GifFileType *GifFile)
}
BitsPerPixel
=
CodeSize
;
/* this can only happen on a severely malformed GIF */
if
(
BitsPerPixel
>
8
)
{
GifFile
->
Error
=
D_GIF_ERR_READ_FAILED
;
/* somewhat bogus error code */
return
GIF_ERROR
;
/* Failed to read Code size. */
}
Private
->
Buf
[
0
]
=
0
;
/* Input Buffer empty. */
Private
->
BitsPerPixel
=
BitsPerPixel
;
Private
->
ClearCode
=
(
1
<<
BitsPerPixel
);
...
...
@@ -1123,7 +1133,7 @@ DGifSlurp(GifFileType *GifFile)
if
(
ImageSize
>
(
SIZE_MAX
/
sizeof
(
GifPixelType
)))
{
return
GIF_ERROR
;
}
sp
->
RasterBits
=
(
unsigned
char
*
)
malloc
(
ImageSize
*
sp
->
RasterBits
=
(
unsigned
char
*
)
reallocarray
(
NULL
,
ImageSize
,
sizeof
(
GifPixelType
));
if
(
sp
->
RasterBits
==
NULL
)
{
...
...
src/share/native/sun/awt/giflib/gif_lib.h
浏览文件 @
686d6c69
...
...
@@ -37,7 +37,7 @@ extern "C" {
#define GIFLIB_MAJOR 5
#define GIFLIB_MINOR 1
#define GIFLIB_RELEASE
1
#define GIFLIB_RELEASE
4
#define GIF_ERROR 0
#define GIF_OK 1
...
...
@@ -274,6 +274,9 @@ extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1,
GifPixelType
ColorTransIn2
[]);
extern
int
GifBitSize
(
int
n
);
extern
void
*
reallocarray
(
void
*
optr
,
size_t
nmemb
,
size_t
size
);
/******************************************************************************
Support for the in-core structures allocation (slurp mode).
******************************************************************************/
...
...
src/share/native/sun/awt/giflib/gifalloc.c
浏览文件 @
686d6c69
...
...
@@ -212,8 +212,8 @@ GifUnionColorMap(const ColorMapObject *ColorIn1,
/* perhaps we can shrink the map? */
if
(
RoundUpTo
<
ColorUnion
->
ColorCount
)
{
GifColorType
*
new_map
=
(
GifColorType
*
)
realloc
(
Map
,
sizeof
(
GifColorType
)
*
RoundUpTo
);
GifColorType
*
new_map
=
(
GifColorType
*
)
realloc
array
(
Map
,
RoundUpTo
,
sizeof
(
GifColorType
)
);
if
(
new_map
==
NULL
)
{
GifFreeMapObject
(
ColorUnion
);
return
((
ColorMapObject
*
)
NULL
);
...
...
@@ -256,9 +256,9 @@ GifAddExtensionBlock(int *ExtensionBlockCount,
if
(
*
ExtensionBlocks
==
NULL
)
*
ExtensionBlocks
=
(
ExtensionBlock
*
)
malloc
(
sizeof
(
ExtensionBlock
));
else
{
ExtensionBlock
*
ep_new
=
(
ExtensionBlock
*
)
realloc
(
*
ExtensionBlocks
,
sizeof
(
ExtensionBlock
)
*
(
*
ExtensionBlockCount
+
1
));
ExtensionBlock
*
ep_new
=
(
ExtensionBlock
*
)
realloc
array
(
*
ExtensionBlocks
,
(
*
ExtensionBlockCount
+
1
),
sizeof
(
ExtensionBlock
));
if
(
ep_new
==
NULL
)
return
(
GIF_ERROR
);
*
ExtensionBlocks
=
ep_new
;
...
...
@@ -349,8 +349,8 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom)
if
(
GifFile
->
SavedImages
==
NULL
)
GifFile
->
SavedImages
=
(
SavedImage
*
)
malloc
(
sizeof
(
SavedImage
));
else
GifFile
->
SavedImages
=
(
SavedImage
*
)
realloc
(
GifFile
->
SavedImages
,
sizeof
(
SavedImage
)
*
(
GifFile
->
ImageCount
+
1
));
GifFile
->
SavedImages
=
(
SavedImage
*
)
realloc
array
(
GifFile
->
SavedImages
,
(
GifFile
->
ImageCount
+
1
),
sizeof
(
SavedImage
));
if
(
GifFile
->
SavedImages
==
NULL
)
return
((
SavedImage
*
)
NULL
);
...
...
@@ -379,9 +379,10 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom)
}
/* next, the raster */
sp
->
RasterBits
=
(
unsigned
char
*
)
malloc
(
sizeof
(
GifPixelType
)
*
CopyFrom
->
ImageDesc
.
Height
*
CopyFrom
->
ImageDesc
.
Width
);
sp
->
RasterBits
=
(
unsigned
char
*
)
reallocarray
(
NULL
,
(
CopyFrom
->
ImageDesc
.
Height
*
CopyFrom
->
ImageDesc
.
Width
),
sizeof
(
GifPixelType
));
if
(
sp
->
RasterBits
==
NULL
)
{
FreeLastSavedImage
(
GifFile
);
return
(
SavedImage
*
)(
NULL
);
...
...
@@ -392,9 +393,9 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom)
/* finally, the extension blocks */
if
(
sp
->
ExtensionBlocks
!=
NULL
)
{
sp
->
ExtensionBlocks
=
(
ExtensionBlock
*
)
malloc
(
sizeof
(
ExtensionBlock
)
*
CopyFrom
->
ExtensionBlockCount
);
sp
->
ExtensionBlocks
=
(
ExtensionBlock
*
)
reallocarray
(
NULL
,
CopyFrom
->
ExtensionBlockCount
,
sizeof
(
ExtensionBlock
)
);
if
(
sp
->
ExtensionBlocks
==
NULL
)
{
FreeLastSavedImage
(
GifFile
);
return
(
SavedImage
*
)(
NULL
);
...
...
src/share/native/sun/awt/giflib/openbsd-reallocarray.c
0 → 100644
浏览文件 @
686d6c69
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* $OpenBSD: reallocarray.c,v 1.1 2014/05/08 21:43:49 deraadt Exp $ */
/*
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
/*
* This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
* if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
*/
#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
void
*
reallocarray
(
void
*
optr
,
size_t
nmemb
,
size_t
size
)
{
if
((
nmemb
>=
MUL_NO_OVERFLOW
||
size
>=
MUL_NO_OVERFLOW
)
&&
nmemb
>
0
&&
SIZE_MAX
/
nmemb
<
size
)
{
errno
=
ENOMEM
;
return
NULL
;
}
/*
* Head off variations in realloc behavior on different
* platforms (reported by MarkR <mrogers6@users.sf.net>)
*
* The behaviour of reallocarray is implementation-defined if
* nmemb or size is zero. It can return NULL or non-NULL
* depending on the platform.
* https://www.securecoding.cert.org/confluence/display/c/MEM04-C.Beware+of+zero-lengthallocations
*
* Here are some extracts from realloc man pages on different platforms.
*
* void realloc( void memblock, size_t size );
*
* Windows:
*
* If there is not enough available memory to expand the block
* to the given size, the original block is left unchanged,
* and NULL is returned. If size is zero, then the block
* pointed to by memblock is freed; the return value is NULL,
* and memblock is left pointing at a freed block.
*
* OpenBSD:
*
* If size or nmemb is equal to 0, a unique pointer to an
* access protected, zero sized object is returned. Access via
* this pointer will generate a SIGSEGV exception.
*
* Linux:
*
* If size was equal to 0, either NULL or a pointer suitable
* to be passed to free() is returned.
*
* OS X:
*
* If size is zero and ptr is not NULL, a new, minimum sized
* object is allocated and the original object is freed.
*
* It looks like images with zero width or height can trigger
* this, and fuzzing behaviour will differ by platform, so
* fuzzing on one platform may not detect zero-size allocation
* problems on other platforms.
*/
if
(
size
==
0
||
nmemb
==
0
)
return
NULL
;
return
realloc
(
optr
,
size
*
nmemb
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录