Skip to content

Commit

Permalink
giflib[-util]: Update to 5.2.2. Libtoolize.
Browse files Browse the repository at this point in the history
This is a point release intended to clear up a couple of CVEs and
apply point fixes that have been accumulating since 5.2.1

There are a few unresolved (but minor) memory leaks related to design
issues in the API that still need to be resolved. Expect those fixes
in the next release.

Code Fixes
----------

* Fixes for CVE-2023-48161, CVE-2022-28506,

* Address SF issue NetBSD#138 Documentation for obsolete utilities still installed

* Address SF issue NetBSD#139: Typo in "LZW image data" page ("110_2 = 4_10")

* Address SF issue NetBSD#140: Typo in "LZW image data" page ("LWZ")

* Address SF issue NetBSD#141: Typo in "Bits and bytes" page ("filed")

* Note as already fixed SF issue NetBSD#143: cannot compile under mingw

* Address SF issue NetBSD#144: giflib-5.2.1 cannot be build on windows and other platforms using c89

* Address SF issue NetBSD#145: Remove manual pages installation for binaries that are not installed too

* Address SF issue NetBSD#146: [PATCH] Limit installed man pages to binaries, move giflib to section 7

* Address SF issue NetBSD#147 [PATCH] Fixes to doc/whatsinagif/ content

* Address SF issue NetBSD#148: heap Out of Bound Read in gif2rgb.c:298 DumpScreen2RGB

* Declared no-info on SF issue NetBSD#150: There is a denial of service vulnerability in GIFLIB 5.2.1

* Declared Won't-fix on SF issue 149: Out of source builds no longer possible

* Address SF issue NetBSD#151: A heap-buffer-overflow in gif2rgb.c:294:45

* Address SF issue #152: Fix some typos on the html documentation and man pages

* Address SF issue #153: Fix segmentation faults due to non correct checking for args

* Address SF issue #154: Recover the giffilter manual page

* Address SF issue #155: Add gifsponge docs

* Address SF issue #157: An OutofMemory-Exception or Memory Leak in gif2rgb

* Address SF issue #158: There is a null pointer problem in gif2rgb

* Address SF issue #159 A heap-buffer-overflow in GIFLIB5.2.1 DumpScreen2RGB() in gif2rgb.c:298:45

* Address SF issue #163: detected memory leaks in openbsd_reallocarray giflib/openbsd-reallocarray.c

* Address SF issue #164: detected memory leaks in GifMakeMapObject giflib/gifalloc.c

* Address SF issue #166: a read zero page leads segment fault in getarg.c and memory leaks in gif2rgb.c and gifmalloc.c

* Address SF issue #167: Heap-Buffer Overflow during Image Saving in DumpScreen2RGB Function at Line 321 of gif2rgb.c
  • Loading branch information
alarixnia committed Sep 18, 2024
1 parent adc4dcd commit df66c76
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 133 deletions.
9 changes: 5 additions & 4 deletions graphics/giflib-util/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# $NetBSD: Makefile,v 1.14 2023/12/21 10:46:15 nros Exp $
# $NetBSD: Makefile,v 1.15 2024/09/18 23:02:59 nia Exp $

PKGREVISION= 1
.include "../../graphics/giflib/Makefile.common"

PKGNAME= ${DISTNAME:S/-/-util-/}
Expand All @@ -15,13 +14,15 @@ INSTALL_ENV+= MANDIR=${PREFIX}/${PKGMANDIR}

HTMLDIR= share/doc/giflib
INSTALLATION_DIRS= ${HTMLDIR} ${HTMLDIR}/gifstandard \
${HTMLDIR}/whatsinagif
${HTMLDIR}/whatsinagif \
${PKGMANDIR}/man1

INSTALL_TARGET= install-bin
INSTALL_TARGET+= install-man
post-install:
cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html \
${DESTDIR}${PREFIX}/${HTMLDIR}
cd ${WRKSRC}/doc && ${INSTALL_DATA} *.1 \
${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
cd ${WRKSRC}/doc/gifstandard && ${INSTALL_DATA} *.txt \
${DESTDIR}${PREFIX}/${HTMLDIR}/gifstandard
cd ${WRKSRC}/doc/whatsinagif && ${INSTALL_DATA} *.html *.gif \
Expand Down
10 changes: 6 additions & 4 deletions graphics/giflib-util/PLIST
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.5 2020/01/07 20:25:14 sevan Exp $
@comment $NetBSD: PLIST,v 1.6 2024/09/18 23:02:59 nia Exp $
bin/gif2rgb
bin/gifbuild
bin/gifclrmp
Expand All @@ -11,10 +11,11 @@ man/man1/gifbuild.1
man/man1/gifclrmp.1
man/man1/gifcolor.1
man/man1/gifecho.1
man/man1/giffilter.1
man/man1/giffix.1
man/man1/gifhisto.1
man/man1/gifinto.1
man/man1/giflib.1
man/man1/gifsponge.1
man/man1/giftext.1
man/man1/giftool.1
man/man1/gifwedge.1
Expand All @@ -25,10 +26,12 @@ share/doc/giflib/gifbuild.html
share/doc/giflib/gifclrmp.html
share/doc/giflib/gifcolor.html
share/doc/giflib/gifecho.html
share/doc/giflib/giffilter.html
share/doc/giflib/giffix.html
share/doc/giflib/gifhisto.html
share/doc/giflib/gifinto.html
share/doc/giflib/giflib.html
share/doc/giflib/gifsponge.html
share/doc/giflib/gifstandard/gif87.txt
share/doc/giflib/gifstandard/gif89.txt
share/doc/giflib/giftext.html
Expand All @@ -43,8 +46,6 @@ share/doc/giflib/whatsinagif/gif_file_stream.gif
share/doc/giflib/whatsinagif/global_color_table.gif
share/doc/giflib/whatsinagif/graphic_control_ext.gif
share/doc/giflib/whatsinagif/header_block.gif
share/doc/giflib/whatsinagif/highlight_green.gif
share/doc/giflib/whatsinagif/highlight_purple.gif
share/doc/giflib/whatsinagif/image_data_block.gif
share/doc/giflib/whatsinagif/image_descriptor_block.gif
share/doc/giflib/whatsinagif/index.html
Expand All @@ -58,6 +59,7 @@ share/doc/giflib/whatsinagif/sample_1_enlarged.gif
share/doc/giflib/whatsinagif/sample_1_trans.gif
share/doc/giflib/whatsinagif/sample_1_trans_blue.gif
share/doc/giflib/whatsinagif/sample_1_trans_red.gif
share/doc/giflib/whatsinagif/sample_2_animation.gif
share/doc/giflib/whatsinagif/sample_2_animation_green.gif
share/doc/giflib/whatsinagif/sample_2_animation_red.gif
share/doc/giflib/whatsinagif/sample_2_animation_yellow.gif
Expand Down
14 changes: 1 addition & 13 deletions graphics/giflib/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# $NetBSD: Makefile,v 1.58 2023/11/09 20:31:00 nia Exp $
# $NetBSD: Makefile,v 1.59 2024/09/18 23:02:59 nia Exp $

.include "Makefile.common"
PKGREVISION= 6

COMMENT= GIF image format library

Expand All @@ -14,15 +13,4 @@ MAKE_JOBS_SAFE= no
INSTALL_TARGET= install-include
INSTALL_TARGET+= install-lib

.include "../../mk/bsd.prefs.mk"

.if ${OPSYS} == "Darwin"
.PHONY: fix-darwin-install-name
post-install: fix-darwin-install-name
fix-darwin-install-name:
. for lib in libgif.7.2.0.dylib
install_name_tool -id ${PREFIX}/lib/${lib} ${DESTDIR}${PREFIX}/lib/${lib}
. endfor
.endif

.include "../../mk/bsd.pkg.mk"
4 changes: 2 additions & 2 deletions graphics/giflib/Makefile.common
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# $NetBSD: Makefile.common,v 1.14 2020/06/05 12:15:16 jperkin Exp $
# $NetBSD: Makefile.common,v 1.15 2024/09/18 23:02:59 nia Exp $
# used by graphics/giflib/Makefile
# used by graphics/giflib-util/Makefile

DISTNAME= giflib-5.2.1
DISTNAME= giflib-5.2.2
CATEGORIES= graphics
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=giflib/}

Expand Down
7 changes: 2 additions & 5 deletions graphics/giflib/PLIST
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
@comment $NetBSD: PLIST,v 1.9 2020/06/05 12:15:16 jperkin Exp $
@comment $NetBSD: PLIST,v 1.10 2024/09/18 23:02:59 nia Exp $
include/gif_lib.h
lib/libgif.a
lib/libgif.so
lib/libgif.so.7
lib/libgif.so.7.2.0
lib/libgif.la
11 changes: 5 additions & 6 deletions graphics/giflib/distinfo
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$NetBSD: distinfo,v 1.28 2023/12/21 10:46:14 nros Exp $
$NetBSD: distinfo,v 1.29 2024/09/18 23:02:59 nia Exp $

BLAKE2s (giflib-5.2.1.tar.gz) = cac59c8c5042cb67b4dfef98e3344a79817e775409bc37839cabcdd184753ad0
SHA512 (giflib-5.2.1.tar.gz) = 4550e53c21cb1191a4581e363fc9d0610da53f7898ca8320f0d3ef6711e76bdda2609c2df15dc94c45e28bff8de441f1227ec2da7ea827cb3c0405af4faa4736
Size (giflib-5.2.1.tar.gz) = 444187 bytes
SHA1 (patch-CVE-2022-28506) = 1c1819a656dfd5ee82ddc4b7981ab42548e76d6a
SHA1 (patch-Makefile) = d8c03a112ce913ce03f4afb128ccef3a42d639c9
BLAKE2s (giflib-5.2.2.tar.gz) = 2a24163a1af876f9241b5971a7e523f054d131661435e4a3ab11b7cf6acc20f1
SHA512 (giflib-5.2.2.tar.gz) = 0865ab2b1904fa14640c655fdb14bb54244ad18a66e358565c00287875d00912343f9be8bfac7658cc0146200d626f7ec9160d7a339f20ba3be6b9941d73975f
Size (giflib-5.2.2.tar.gz) = 447175 bytes
SHA1 (patch-Makefile) = 9c76f45626d7e4a406df89aef051a73dbc56ddb8
18 changes: 0 additions & 18 deletions graphics/giflib/patches/patch-CVE-2022-28506

This file was deleted.

170 changes: 89 additions & 81 deletions graphics/giflib/patches/patch-Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
$NetBSD: patch-Makefile,v 1.7 2023/12/21 10:46:15 nros Exp $
$NetBSD: patch-Makefile,v 1.8 2024/09/18 23:02:59 nia Exp $

- Inherit the PREFIX rather than hard-coding it.
- Allow override of MANDIR to install manpages correctly
- Apply <https://sourceforge.net/p/giflib/bugs/_discuss/thread/4e811ad29b/>
to fix Darwin build
- Libtoolize.
- Allow override of PREFIX and MANDIR.
- Allow separate installation of utilities.
- Move quantize.c back into libgif.so to fix various library users.

--- Makefile.orig 2019-06-24 16:08:57.000000000 +0000
--- Makefile.orig 2024-02-19 01:01:50.000000000 +0000
+++ Makefile
@@ -8,17 +8,17 @@
#
Expand All @@ -29,104 +28,113 @@ $NetBSD: patch-Makefile,v 1.7 2023/12/21 10:46:15 nros Exp $

# No user-serviceable parts below this line

@@ -29,14 +29,16 @@ LIBPOINT=0
@@ -29,13 +29,13 @@ LIBPOINT=0
LIBVER=$(LIBMAJOR).$(LIBMINOR).$(LIBPOINT)

SOURCES = dgif_lib.c egif_lib.c gifalloc.c gif_err.c gif_font.c \
- gif_hash.c openbsd-reallocarray.c
+ gif_hash.c openbsd-reallocarray.c quantize.c
HEADERS = gif_hash.h gif_lib.h gif_lib_private.h
OBJECTS = $(SOURCES:.c=.o)
-OBJECTS = $(SOURCES:.c=.o)
+OBJECTS = $(SOURCES:.c=.lo)

-USOURCES = qprintf.c quantize.c getarg.c
+USOURCES = qprintf.c getarg.c
UHEADERS = getarg.h
UOBJECTS = $(USOURCES:.c=.o)

+UNAME:=$(shell uname)
-UOBJECTS = $(USOURCES:.c=.o)
+UOBJECTS = $(USOURCES:.c=.lo)

UNAME:=$(shell uname)

@@ -61,7 +61,7 @@ UTILS = $(INSTALLABLE) \
gifsponge \
gifwedge

-LDLIBS=libgif.a -lm
+LDLIBS=-L$(PREFIX)/lib $(COMPILER_RPATH_FLAG)$(PREFIX)/lib -lgif -lm

MANUAL_PAGES = \
doc/gif2rgb.xml \
@@ -72,45 +72,30 @@ MANUAL_PAGES = \
doc/giftext.xml \
doc/giftool.xml

-SOEXTENSION = so
+SOEXTENSION = la
LIBGIFSO = libgif.$(SOEXTENSION)
LIBGIFSOMAJOR = libgif.$(SOEXTENSION).$(LIBMAJOR)
LIBGIFSOVER = libgif.$(SOEXTENSION).$(LIBVER)
LIBUTILSO = libutil.$(SOEXTENSION)
LIBUTILSOMAJOR = libutil.$(SOEXTENSION).$(LIBMAJOR)
-ifeq ($(UNAME), Darwin)
-SOEXTENSION = dylib
-LIBGIFSO = libgif.$(SOEXTENSION)
-LIBGIFSOMAJOR = libgif.$(LIBMAJOR).$(SOEXTENSION)
-LIBGIFSOVER = libgif.$(LIBVER).$(SOEXTENSION)
-LIBUTILSO = libutil.$(SOEXTENSION)
-LIBUTILSOMAJOR = libutil.$(LIBMAJOR).$(SOEXTENSION)
-endif

-all: $(LIBGIFSO) libgif.a $(LIBUTILSO) libutil.a $(UTILS)
-ifeq ($(UNAME), Darwin)
-else
- $(MAKE) -C doc
-endif
+all: $(LIBGIFSO) $(LIBUTILSO)

-$(UTILS):: libgif.a libutil.a
+.SUFFIXES: .lo

-$(LIBGIFSO): $(OBJECTS) $(HEADERS)
-ifeq ($(UNAME), Darwin)
- $(CC) $(CFLAGS) -dynamiclib -current_version $(LIBVER) $(OBJECTS) -o $(LIBGIFSO)
-else
- $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname -Wl,$(LIBGIFSOMAJOR) -o $(LIBGIFSO) $(OBJECTS)
-endif
+.c.lo:
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(CFLAGS) -c $<
+
# Some utilities are installed
INSTALLABLE = \
gif2rgb \
@@ -61,27 +63,38 @@ UTILS = $(INSTALLABLE) \

LDLIBS=libgif.a -lm
+.libs/libgif.a: $(LIBGIFSO)
+.libs/libutil.a: $(LIBUTILSO)

-all: libgif.so libgif.a libutil.so libutil.a $(UTILS)
- $(MAKE) -C doc
+ifeq ($(UNAME), Darwin)
+SOEXTENSION = dylib
+LIBGIFSOMAJOR = libgif.$(LIBMAJOR).$(SOEXTENSION)
+LIBGIFSOVER = libgif.$(LIBVER).$(SOEXTENSION)
+else
+SOEXTENSION = so
+LIBGIFSOMAJOR = libgif.$(SOEXTENSION).$(LIBMAJOR)
+LIBGIFSOVER = libgif.$(SOEXTENSION).$(LIBVER)
+endif
+LIBGIFSO = libgif.$(SOEXTENSION)
-libgif.a: $(OBJECTS) $(HEADERS)
- $(AR) rcs libgif.a $(OBJECTS)
+$(UTILS): .libs/libgif.a .libs/libutil.a
+
+all: $(LIBGIFSO) libgif.a libutil.a $(UTILS)
+$(LIBGIFSO): $(OBJECTS) $(HEADERS)
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(CFLAGS) $(LDFLAGS) -version-info $(LIBMAJOR):0:0 -rpath $(PREFIX)/lib -o $(LIBGIFSO) $(OBJECTS)

$(UTILS):: libgif.a libutil.a
$(LIBUTILSO): $(UOBJECTS) $(UHEADERS)
-ifeq ($(UNAME), Darwin)
- $(CC) $(CFLAGS) -dynamiclib -current_version $(LIBVER) $(OBJECTS) -o $(LIBUTILSO)
-else
- $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname -Wl,$(LIBUTILMAJOR) -o $(LIBUTILSO) $(UOBJECTS)
-endif
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(CFLAGS) $(LDFLAGS) -version-info $(LIBMAJOR):0:0 -rpath $(PREFIX)/lib -o $(LIBUTILSO) $(UOBJECTS)

-libgif.so: $(OBJECTS) $(HEADERS)
- $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname -Wl,libgif.so.$(LIBMAJOR) -o libgif.so $(OBJECTS)
+$(LIBGIFSO): $(OBJECTS) $(HEADERS)
+ifeq ($(UNAME), Darwin)
+ $(CC) $(CFLAGS) -dynamiclib -current_version $(LIBVER) $(OBJECTS) -o $(LIBGIFSO)
+else
+ $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname -Wl,$(LIBGIFSOMAJOR) -o $(LIBGIFSO) $(OBJECTS)
+endif

libgif.a: $(OBJECTS) $(HEADERS)
$(AR) rcs libgif.a $(OBJECTS)

-libutil.so: $(UOBJECTS) $(UHEADERS)
- $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname -Wl,libutil.so.$(LIBMAJOR) -o libutil.so $(UOBJECTS)
-
libutil.a: $(UOBJECTS) $(UHEADERS)
$(AR) rcs libutil.a $(UOBJECTS)

clean:
- rm -f $(UTILS) $(TARGET) libgetarg.a libgif.a libgif.so libutil.a libutil.so *.o
- rm -f libgif.so.$(LIBMAJOR).$(LIBMINOR).$(LIBPOINT)
- rm -f libgif.so.$(LIBMAJOR)
+ rm -f $(UTILS) $(TARGET) libgetarg.a libgif.a $(LIBGIFSO) libutil.a *.o
+ rm -f $(LIBGIFSOVER)
+ rm -f $(LIBGIFSOMAJOR)
rm -fr doc/*.1 *.html doc/staging

check: all
@@ -89,7 +102,8 @@ check: all
@@ -129,11 +114,7 @@ reflow:

# Installation/uninstallation

-install: all install-bin install-include install-lib install-man
+install: all install-bin install-include install-lib
+
-ifeq ($(UNAME), Darwin)
-install: all install-bin install-include install-lib
-else
install: all install-bin install-include install-lib install-man
-endif

install-bin: $(INSTALLABLE)
$(INSTALL) -d "$(DESTDIR)$(BINDIR)"
$(INSTALL) $^ "$(DESTDIR)$(BINDIR)"
@@ -99,9 +113,10 @@ install-include:
@@ -143,10 +124,7 @@ install-include:
$(INSTALL) -m 644 gif_lib.h "$(DESTDIR)$(INCDIR)"
install-lib:
$(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
$(INSTALL) -m 644 libgif.a "$(DESTDIR)$(LIBDIR)/libgif.a"
- $(INSTALL) -m 755 libgif.so "$(DESTDIR)$(LIBDIR)/libgif.so.$(LIBVER)"
- ln -sf libgif.so.$(LIBVER) "$(DESTDIR)$(LIBDIR)/libgif.so.$(LIBMAJOR)"
- ln -sf libgif.so.$(LIBMAJOR) "$(DESTDIR)$(LIBDIR)/libgif.so"
+ $(INSTALL) -m 755 $(LIBGIFSO) "$(DESTDIR)$(LIBDIR)/$(LIBGIFSOVER)"
+ ln -sf $(LIBGIFSOVER) "$(DESTDIR)$(LIBDIR)/$(LIBGIFSOMAJOR)"
+ ln -sf $(LIBGIFSOMAJOR) "$(DESTDIR)$(LIBDIR)/$(LIBGIFSO)"
+
- $(INSTALL) -m 644 libgif.a "$(DESTDIR)$(LIBDIR)/libgif.a"
- $(INSTALL) -m 755 $(LIBGIFSO) "$(DESTDIR)$(LIBDIR)/$(LIBGIFSOVER)"
- ln -sf $(LIBGIFSOVER) "$(DESTDIR)$(LIBDIR)/$(LIBGIFSOMAJOR)"
- ln -sf $(LIBGIFSOMAJOR) "$(DESTDIR)$(LIBDIR)/$(LIBGIFSO)"
+ $(LIBTOOL) --mode=install --tag=CC $(BSD_INSTALL_LIB) $(LIBGIFSO) "$(DESTDIR)$(LIBDIR)"
install-man:
$(INSTALL) -d "$(DESTDIR)$(MANDIR)/man1"
$(INSTALL) -m 644 doc/*.1 "$(DESTDIR)$(MANDIR)/man1"
@@ -112,7 +127,7 @@ uninstall-include:
rm -f "$(DESTDIR)$(INCDIR)/gif_lib.h"
uninstall-lib:
cd "$(DESTDIR)$(LIBDIR)" && \
- rm -f libgif.a libgif.so libgif.so.$(LIBMAJOR) libgif.so.$(LIBVER)
+ rm -f libgif.a $(LIBGIFSO) $(LIBGIFSOMAJOR) $(LIBGIFSOVER)
uninstall-man:
cd "$(DESTDIR)$(MANDIR)/man1" && rm -f $(shell cd doc >/dev/null && echo *.1)

$(INSTALL) -m 644 $(MANUAL_PAGES) "$(DESTDIR)$(MANDIR)/man1"

0 comments on commit df66c76

Please sign in to comment.