Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
f25c1371e2
!57 [sync] PR-54: Fix heap-buffer overflow
From: @openeuler-sync-bot 
Reviewed-by: @weidongkl 
Signed-off-by: @weidongkl
2024-12-18 02:13:24 +00:00
wk333
d6dfa15963 Fix heap-buffer overflow
(cherry picked from commit 2c10c1abf8ff2e88b1da04e050bb721487b73fa3)
2024-12-18 09:13:00 +08:00
openeuler-ci-bot
ac11282213
!50 [sync] PR-47: Update to 5.2.2 for fix CVE-2020-23922 and CVE-2023-48161
From: @openeuler-sync-bot 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2024-06-24 11:03:01 +00:00
starlet-dx
3dc80d1b01 Update to 5.2.2 for fix CVE-2020-23922 and CVE-2023-48161
(cherry picked from commit 6dade95e2078d5374b10eca28244e9905076bc46)
2024-06-24 14:38:54 +08:00
openeuler-ci-bot
b7d6c6a6fe
!44 [sync] PR-39: Fix CVE-2021-40633
From: @openeuler-sync-bot 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2024-05-22 02:39:52 +00:00
liwenjie
3bd4766b16 Fix CVE-2021-40633
(cherry picked from commit b3034393b8b867639a31145e5bd6aac748b1fd87)
2024-05-15 23:34:36 +08:00
openeuler-ci-bot
0c596d513e
!30 [sync] PR-26: Fix CVE-2023-39742
From: @openeuler-sync-bot 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2023-09-16 02:56:44 +00:00
Funda Wang
066fb268d0 Fix CVE-2023-39742
(cherry picked from commit 08694f066548bb6e406cdafe9828fc27a988e6d4)
2023-09-16 09:33:10 +08:00
openeuler-ci-bot
424b73d0fc
!25 [sync] PR-23: 同步22.09 release到22.03-LTS
From: @openeuler-sync-bot 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
2022-12-05 01:13:48 +00:00
wk333
9b6d2443f9 Sync 22.09 release to 22.03
(cherry picked from commit 1523a8d08213d6a2a07242c7b25e0ac86c8f598a)
2022-12-05 09:05:25 +08:00
8 changed files with 116 additions and 49 deletions

13
CVE-2021-40633.patch Normal file
View File

@ -0,0 +1,13 @@
diff -urN giflib-5.2.2/gif2rgb.c giflib-5.2.2-bak/gif2rgb.c
--- giflib-5.2.2/gif2rgb.c 2024-05-14 16:06:40.098092160 +0800
+++ giflib-5.2.2-bak/gif2rgb.c 2024-05-14 15:53:42.426757251 +0800
@@ -525,6 +525,9 @@
DumpScreen2RGB(OutFileName, OneFileFlag, ColorMap, ScreenBuffer,
GifFile->SWidth, GifFile->SHeight);
+ for (i = 0; i < GifFile->SHeight; i++) {
+ (void)free(ScreenBuffer[i]);
+ }
(void)free(ScreenBuffer);
{

View File

@ -0,0 +1,30 @@
From d132ecb1402dde84ce9851bddaa6587a90014e07 Mon Sep 17 00:00:00 2001
From: wk333 <13474090681@163.com>
Date: Tue, 17 Dec 2024 15:44:15 +0800
Subject: [PATCH 1/1] Fix heap-buffer overflow
Refer: https://sourceforge.net/u/mmuzila/giflib/ci/fix-cve-2022-28506/
---
gif2rgb.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gif2rgb.c b/gif2rgb.c
index 2b4bb23..0b2e05a 100644
--- a/gif2rgb.c
+++ b/gif2rgb.c
@@ -337,6 +337,11 @@ static void DumpScreen2RGB(char *FileName, int OneFileFlag,
GifRow = ScreenBuffer[i];
GifQprintf("\b\b\b\b%-4d", ScreenHeight - i);
for (j = 0; j < ScreenWidth; j++) {
+ /* Check if color is within color palete */
+ if (GifRow[j] >= ColorMap->ColorCount) {
+ GIF_EXIT(GifErrorString(
+ D_GIF_ERR_IMAGE_DEFECT));
+ }
ColorMapEntry = &ColorMap->Colors[GifRow[j]];
Buffers[0][j] = ColorMapEntry->Red;
Buffers[1][j] = ColorMapEntry->Green;
--
2.33.0

Binary file not shown.

BIN
giflib-5.2.2.tar.gz Normal file

Binary file not shown.

View File

@ -1,8 +1,8 @@
%define debug_package %{nil}
Name: giflib
Version: 5.2.1
Release: 3
Version: 5.2.2
Release: 2
Summary: A library and utilities for processing GIFs
License: MIT
URL: http://www.sourceforge.net/projects/giflib/
@ -14,8 +14,11 @@ Patch0:giflib_quantize.patch
Patch1:giflib_coverity.patch
# Generate HTML docs with consistent section IDs to avoid multilib difference
Patch2:giflib_html-docs-consistent-ids.patch
Patch3:CVE-2021-40633.patch
Patch4:Fix-heap-buffer-overflow.patch
BuildRequires: make xmlto gcc
BuildRequires: ImageMagick
provides: giflib-utils
%description
@ -42,7 +45,7 @@ format imange files.
%autosetup -n %{name}-%{version} -p1
%build
%make_build
%make_build CFLAGS="$RPM_OPT_FLAGS -s -fPIC"
%install
%make_install PREFIX="%{_prefix}" LIBDIR="%{_libdir}"
@ -67,12 +70,37 @@ rm -f %{buildroot}/debugsourcefiles.list
%files help
%defattr(-,root,root)
%{_mandir}/man1/gif*.1*
%{_mandir}/man1/gif*.*
%files utils
%{_bindir}/gif*
%changelog
* Tue Dec 17 2024 wangkai <13474090681@163.com> - 5.2.2-2
- Fix heap-buffer overflow
* Fri Jun 21 2024 yaoxin <yao_xin001@hoperun.com> - 5.2.2-1
- Update to 5.2.2
* Fixes for CVE-2023-48161 (bsc#1217390), CVE-2022-28506 (bsc#1198880)
* Address SF issue #151: A heap-buffer-overflow in gif2rgb.c:294:45
* Address SF issue #166: a read zero page leads segment fault in
getarg.c and memory leaks in gif2rgb.c and gifmalloc.c
* Tue May 14 2024 liwenjie <liwenjie@kylinos.cn> - 5.2.1-8
- Fix CVE-2021-40633
* Fri Sep 15 2023 Funda Wang <fundawang@yeah.net> - 5.2.1-7
- Fix CVE-2023-39742
* Thu Aug 25 2022 caodongxia <caodongxia@h-partners.com> -5.2.1-6
- Fix rpmbuild error
* Wed Jun 15 2022 duyiwei <duyiwei@kylinos.cn> - 5.2.1-5
- fix CVE-2022-28506
* Sat Sep 4 2021 zhanzhimin <zhanzhimin@huawei.com> - 5.2.1-4
- strip binary files
* Thu May 20 2021 liuyumeng <liuyumeng5@huawei.com> - 5.2.1-3
- Add a package named utils

View File

@ -1,43 +1,39 @@
diff -rupN --no-dereference giflib-5.2.1/gif2rgb.c giflib-5.2.1-new/gif2rgb.c
--- giflib-5.2.1/gif2rgb.c 2019-06-24 09:24:27.000000000 +0200
+++ giflib-5.2.1-new/gif2rgb.c 2020-02-17 16:51:04.468397502 +0100
@@ -170,6 +170,8 @@ static void SaveGif(GifByteType *OutputB
/* Open stdout for the output file: */
if ((GifFile = EGifOpenFileHandle(1, &Error)) == NULL) {
PrintGifError(Error);
+ free(OutputBuffer);
+ GifFreeMapObject(OutputColorMap);
exit(EXIT_FAILURE);
}
diff -rupN --no-dereference giflib-5.2.2/gif2rgb.c giflib-5.2.2-new/gif2rgb.c
--- giflib-5.2.2/gif2rgb.c 2024-02-19 04:01:28.000000000 +0100
+++ giflib-5.2.2-new/gif2rgb.c 2024-02-19 09:39:38.750976758 +0100
@@ -165,6 +165,8 @@ static void SaveGif(GifByteType *OutputB
/* Open stdout for the output file: */
if ((GifFile = EGifOpenFileHandle(1, &Error)) == NULL) {
PrintGifError(Error);
+ free(OutputBuffer);
+ GifFreeMapObject(OutputColorMap);
exit(EXIT_FAILURE);
}
@@ -179,6 +181,8 @@ static void SaveGif(GifByteType *OutputB
EGifPutImageDesc(GifFile,
0, 0, Width, Height, false, NULL) == GIF_ERROR) {
PrintGifError(Error);
+ free(OutputBuffer);
+ GifFreeMapObject(OutputColorMap);
exit(EXIT_FAILURE);
}
@@ -173,6 +175,8 @@ static void SaveGif(GifByteType *OutputB
EGifPutImageDesc(GifFile, 0, 0, Width, Height, false, NULL) ==
GIF_ERROR) {
PrintGifError(Error);
+ free(OutputBuffer);
+ GifFreeMapObject(OutputColorMap);
exit(EXIT_FAILURE);
}
@@ -187,8 +191,11 @@ static void SaveGif(GifByteType *OutputB
GifFile->Image.Width, GifFile->Image.Height);
@@ -182,6 +186,8 @@ static void SaveGif(GifByteType *OutputB
for (i = 0; i < Height; i++) {
- if (EGifPutLine(GifFile, Ptr, Width) == GIF_ERROR)
+ if (EGifPutLine(GifFile, Ptr, Width) == GIF_ERROR) {
+ free(OutputBuffer);
+ GifFreeMapObject(OutputColorMap);
exit(EXIT_FAILURE);
+ }
GifQprintf("\b\b\b\b%-4d", Height - i - 1);
for (i = 0; i < Height; i++) {
if (EGifPutLine(GifFile, Ptr, Width) == GIF_ERROR) {
+ free(OutputBuffer);
+ GifFreeMapObject(OutputColorMap);
exit(EXIT_FAILURE);
}
GifQprintf("\b\b\b\b%-4d", Height - i - 1);
@@ -191,6 +197,8 @@ static void SaveGif(GifByteType *OutputB
Ptr += Width;
@@ -196,6 +203,8 @@ static void SaveGif(GifByteType *OutputB
if (EGifCloseFile(GifFile, &Error) == GIF_ERROR) {
PrintGifError(Error);
+ free(OutputBuffer);
+ GifFreeMapObject(OutputColorMap);
exit(EXIT_FAILURE);
}
if (EGifCloseFile(GifFile, &Error) == GIF_ERROR) {
PrintGifError(Error);
+ free(OutputBuffer);
+ GifFreeMapObject(OutputColorMap);
exit(EXIT_FAILURE);
}
}

View File

@ -1,8 +1,8 @@
diff -rupN --no-dereference giflib-5.2.1/doc/Makefile giflib-5.2.1-new/doc/Makefile
--- giflib-5.2.1/doc/Makefile 2019-03-28 18:05:25.000000000 +0100
+++ giflib-5.2.1-new/doc/Makefile 2020-02-17 16:51:04.489397582 +0100
diff -rupN --no-dereference giflib-5.2.2/doc/Makefile giflib-5.2.2-new/doc/Makefile
--- giflib-5.2.2/doc/Makefile 2024-02-18 19:15:05.000000000 +0100
+++ giflib-5.2.2-new/doc/Makefile 2024-02-19 09:39:38.785968237 +0100
@@ -1,7 +1,7 @@
.SUFFIXES: .xml .html .txt .adoc .1
.SUFFIXES: .xml .html .txt .adoc .1 .7
.xml.html:
- xmlto xhtml-nochunks $<

View File

@ -1,6 +1,6 @@
diff -rupN --no-dereference giflib-5.2.1/Makefile giflib-5.2.1-new/Makefile
--- giflib-5.2.1/Makefile 2019-06-24 18:08:57.000000000 +0200
+++ giflib-5.2.1-new/Makefile 2020-02-17 16:51:04.450397434 +0100
diff -rupN --no-dereference giflib-5.2.2/Makefile giflib-5.2.2-new/Makefile
--- giflib-5.2.2/Makefile 2024-02-19 02:01:50.000000000 +0100
+++ giflib-5.2.2-new/Makefile 2024-02-19 09:39:38.715985279 +0100
@@ -29,11 +29,11 @@ LIBPOINT=0
LIBVER=$(LIBMAJOR).$(LIBMINOR).$(LIBPOINT)