9 * Code hardening using reallocarray() from OpenBSD.
11 * Sanity check in giffilter catches files with malformed extension records
12 Fixes SourceForge bug #63: malformed gif causes segfault in giffilter.
14 * Inexpensive sanity check in DGifSlurp() catches malformed files with
15 no image descriptor. Fixes SourceForge bug #64: malformed gif causes
18 * Fix SourceForge bug #66: GifDrawBoxedText8x8() modifying constant input
21 * Bail out of GIF read on invalid pixel width. Addresses Savannah bug
22 #67: invalid shift in dgif_lib.c
24 * Fix SourceForge bug #69: #69 Malformed: Gif file with no extension
25 block after a GRAPHICS_EXT_FUNC_CODE extension causes segfault (in
28 * Fix SourceForge bug #71: Buffer overwrite when giffixing a malformed gif.
30 * Fix SourceForge bug #73: Null pointer deference in gifclrmap (only
31 reachable with malformed GIF).
33 * Fix SourceForge bug #74: Double free in gifsponge under 5.1,1,
34 for any valid gif image.
36 * Fix SourceForge bug #75: GAGetArgs overflows due to uncounted use of va_arg.
38 * Sanity check in giffix catches some malformed files. Addresses
39 SourceForge bug #77: dgif_lib.c: extension processing error
48 * Numerous minor fixes in getarg.c. Affects only the utilities, not the
51 * Fix SourceForge bug #59: DGifOpen can segfault if DGifGetScreenDesc fails.
53 * SourceForge patch #20: In gifalloc, fix usage of realloc() in case of failure.
55 * Fix SourceForge bug #61 Leak in gifsponge.
60 * glibtoolize port fix for OS X.
65 Changes to the API require a library major-version bump.
70 * A small change to the API: DGifClose() and EGifClose() now take a
71 pointer-to-int second argument (like the corresponding openers)
72 where a diagnostic code will be deposited when they return
73 GIF_ERROR. This replaces the old behavior in which the GifFile
74 structure was left unfreed so the Error member in it could be filled
75 and remain available. The change was was required because it's
76 not always possible to free the struct afterwards. Case in point is
77 a C# wrapper for giflib (or any language/environment where you can't
78 just free objects allocated in a foreign shared library.)
80 * Minor fix for SF bug #56; BitsPerPixel may be left as uninitialized
81 value when reading (truncated) gif.
83 * Applied SF patch #17: Use a fallback on Windows where mkstemp is not
86 * Applied SF patch #15: Code hardening, preventing spurious
87 defective-image messages.
92 * Removed gif2raw from utils. Its blithe assumption that the EGA16
93 palette is a reliable default is now about 20 years obsolete. Format
94 conversion is better done with convert(1) from the ImageMagick suite,
100 Minor fix for a rare memory leak (SF bug #55).
104 Repair the internal quantization function used in gif2rgb so it's
105 less vulnerable to cross-platform skew due to qsort() being unstable.
106 This shouldn't affect production use, it's just a cross-platform
107 issue for regression testing
112 Set the error return properly when a screen descriptor read fails.
113 Fixes for some minor API documentation bugs. Some internal manual
114 pages are not to be installed.
119 Fix for a rare misrendering bug when a GIF overruns the decompression-code
120 table. The image on which this was spotted was a relatively long-running
121 animated GIF; still images of ordinary size should have been immune.
126 Fix a build-system glitch so it will install manpages.
131 Documentation and polish
132 ------------------------
133 * Partial build is now possible on systems without xmlto.
137 * Change unused return of EGifSetGifVersion() to void.
138 * Buffer overrun prevention in gifinto.
143 Documentation and polish
144 ------------------------
145 * There is now an installable manual page for the GIFLIB utility kit.
149 * gifinter is gone. Use convert -interlace from the ImageMagic suite.
153 * In 5.0.0 the private gif89 bit wasn't being guaranteed cleared at
154 the beginning of EGifGetGifVersion(); this occasionally led to an
155 incorrect version prefix being issued dependent on the state of
157 * An EGifSetGifVersion() function taking a GifFile argument has been
158 added for use with the low-level sequential API. This change requires
159 a bump of the library revision number.
164 Changes to the API require a library major-version bump. Certain
165 initialization functions have acquired an integer address argument for
166 passing back an error code, in order to avoid thread-unsafe static
167 storage. Application code using extension blocks will require minor
168 changes. A few functions have been renamed.
172 * Fixes applied for CVE-2005-2974 and CVE-2005-3350
173 This closes Debian bug #337972.
180 The library is now completely re-entrant and thread-safe.
182 * Library error handling no longer uses a static cell to store the last
183 error code registered; that made the library thread-unsafe. For functions
184 other than GIF file openers, the code is now put in an Error member of
185 the GifFileType structure. The GifError() and GifLastError() functions
186 that referenced that static cell are gone, and the GifErrorString()
187 function introduced in the 4.2 release now takes an explicit error code
189 * GIF file openers - DGifOpenFileName(), DGifOpenFileHandle(), DGifOpen(),
190 EGifOpenFileName(), EGifOpenFileHandle(), and EGifOpen() - all now take
191 a final integer address argument. If non-null, this is used to pass
192 back an error code when the function returns NULL.
196 The ExtensionBlock API has been repaired, solving some problems with GIF89
197 extension handling in earlier versions.
199 * DGifSlurp() and EGifSpew() now preserve trailing extension blocks with
200 no following image file.
201 * Three documented functions - EGifPutExtensionFirst(), EGifPutExtensionNext(),
202 and EGifPutExtensionLast() - have been relaced by new functions
203 EGifPutExtensionLeader(), EGifPutExtensionBlock(), and
204 EGifPutExtensionTrailer(). See the Compatibility section of
205 the library API documentation for details.
206 * New functions DGifSavedExtensionToGCB() and EGifGCBToSavedExtension()
207 make it easy to read and edit GIF89 graphics control blocks in saved images.
211 All functions exported by giflib now have DGif, EGif, or Gif as a name prefix.
213 * Three documented functions - MakeMapObject(), FreeMapObject(), and
214 UnionColorMap() - have been renamed to GifMakeMapObject(),
215 GifFreeMapObject(), and GifUnionColorMap() respectively.
216 * The library Draw* functions are now prefixed GifDraw*, and the
217 text-drawing ones are suffixed with "8x8". This fixes a conflict
218 with the Windows API and leaves the door open for more general text-drawing
219 functions with different font sizes.
223 * DGifSlurp() and EGifSpew() now read and write interlaced images properly.
224 * The amazingly obscure colormap sort flag and pixel aspect ratio
225 features of GIF are now read and preserved, for whatever good that
227 * Six undocumented functions have been renamed; five of these take additional
228 or slightly different argument types. See the Compatibility section of
229 the library API documentation for details.
230 * There's now an EGifGetGifVersion() that computes the version EGifSpew()
232 * QuantizeBuffer() has been returned to the core library as GifQuantizeBuffer()
233 - turns out some important applications (notably mplayer) were using it.
234 * TRUE and FALSE macros are gone, also VoidPtr. No more namespace pollution.
235 * Various arguments have been made const where possible.
239 * The (undocumented) gifinfo utility is gone. Use giftool -f instead.
240 * The gifburst utility is gone. Everybody has image viewers that
241 can pan now, and removing it gets rid of a dependency on Perl.
242 * gifcompose is gone. It was a decent idea when I wrote it in 1989,
243 but I did the same thing better and cleaner a decade later with
244 PILdriver in the PIL package. Removing it gets rid of a dependency
246 * gif2x11 gifasm, gifcomb, gifflip, gifovly, gifpos, gifresize, and gifrotate
247 are all gone. The ImageMagick display(1)/convert(1) utilities and PILdriver
248 do these things better and in a format-independent way.
249 * Lennie Araki's Windows C++ wrapper is gone. It's eight years old,
250 unmaintained, he has dropped out of sight, and a better one needs to
251 be written to use the high-level GIFLIB API and GIF89 graphics
252 control extension support. We'll carry such a wrapper when we have
254 * EGifSetVersion(), introduced in 4.2, is gone. The library always
255 writes GIF87 or GIF89 as required by the data. This change helps
260 * Several utilities have been renamed to (a) fix last-century's habit
261 of arbitarily smashing vowels out of names to make them just one or two
262 characters shorter, (b) ensure that every utility in this set has 'gif'
263 as a name prefix. Here's the list:
265 giffiltr -> giffilter
266 gifspnge -> gifsponge
271 * To go with its new name, gif2raw now dumps raw pixels from a GIF if the
272 (previously required) size option is missing.
273 * Standalone rgb2gif is gone; the same capability is now a mode of gif2rgb.
274 * giftext displays the parsed contents of GIF89 graphics control blocks.
275 * gifbuild handles GIF89 graphics control blocks and Netscape animation
276 loop blocks; it can can display and update either.
277 * gifrotate and other filter utilities now preserve extension blocks,
278 including the graphics control information for transparency and delay time.
279 * A new utility, giftool, supports a wide variety of filtering operations
280 on GIFs, including: setting background and transparency colors, changing
281 interlacing, setting image delays, setting the user-input flag, and setting
282 the aspect-ratio byte. It can sequence multiple operations.
283 * The test-pattern generators gifbg, gifcolor, gihisto and gifwedge and the
284 code templates giffilter and gifsponge are no longer installed by default.
286 Documentation and polish
287 ------------------------
288 * The history.txt and build.txt and files from 4.2.0 now have .asc extensions
289 to indicate that they use asciidoc markup, contrasting with the txt
290 standards files from CompuServe.
291 * The documentation now includes "What's In A GIF", a very detailed narrative
292 description of the file format.
293 * The -A option of gifasm (for inserting a loop control block) is documented.
294 * The documentation directory includes a copy of the original GIF87
295 specification as well as GIF89's.
296 * The project now has a logo.
301 Now maintained by ESR again after handoff by Toshio Kuratomi.
305 * Code updated internally to C99 to enable more correctness checks by
306 the compiler. Compiles under GCC 4.6.1 without errors or warnings.
307 * A rare resource leak in the colormap-object maker was found with
309 * The code now audits clean under Coverity and cppcheck.
310 * splint cleanup begun, there's a lot of work still to do on this.
314 * The default GIF version to write is now computed at write time from
315 the types of an image's extension blocks, but can be overridden with
317 * EGifSpew() is now thread-safe.
318 * Two new functions, GifError() and GifErrorString(),
319 return the error state in a form that can be used by programs.
320 * Two library functions - EGifOpenFileName() and EGifPutImageDesc() -
321 now have bool rather than int flag arguments. Since bool is a
322 typedef of int and TRUE/FALSE have been redefined to true/false,
323 both source and object compatibility with older library versions
325 * GAGetArgs(), used only in the utilities, now returns bool rather
327 * The undocumented GIF_LIB_VERSION symbol is gone from the library header.
328 It has been replaced with three documented symbols: GIFLIB_MAJOR,
329 GIFLIB_MINOR, and GIFLIB_RELEASE.
333 * The gif2epsn and gif2iris utilities are gone. They were full of
334 platform dependencies for platforms long dead. There are enough
335 platform-independent GIF viewers in the world that these weren't
336 adding any value. Removing these gets rid of a dependency on GL.
337 * The rle2gif, gif2rle, and gif2ps utilities are also gone. There are enough
338 multiformat image converters in the world that these weren't adding
339 any value either. Removing them reduces the codebase's dependencies.
340 * The undocumented DumpScreen2Gif() is gone from the library. The
341 only non-obsolete capture mode it supported was through X, and that
342 probably hasn't been used in years and is replaceable by any number
343 of capture utilities. Dropping this code makes the library's
344 portability issues go away.
345 * QuantizeBuffer(), GifQprintf(), PrintGifError(), GIF_ERROR()
346 and GIF_MESSAGE() have been removed from the core library.
347 They were used only by the utilities. QuantizeBuffer() has been
348 inlined where it was used and the latter three are now part of the
349 utility support library.
350 * The Game Boy Advanced test code is gone. The platform was discontinued
351 in 2008; more to the point, nobody ever documented the code's assumptions
353 * The Changelog file is now retained for archival purposes only, and because
354 autotools throws a hissy fit if there isn't one. The single point of
355 truth about changes and the reasons for them is the repository history.
359 * The -q option of the utilities is replaced by an opposite -v (verbose)
360 option; the default is now quiet for all platforms. Defaulting to chattiness
361 on MSDOS made sense in a world of slow text consoles, but not today.
365 * There is now a proper regression-test suite; run 'make' in tests/.
366 The old test-unx script is now tests/visual-check and can be run
367 occasionally for a check with the Mark One Eyeball.
371 * Build instructions now live in build.txt
372 * An overview of the giflib API now lives in api.txt.
373 * Documentation is now in DocBook-XML, so either HTML or man pages can
374 be generated from it.
378 Brown paper bag release. Fix a problem with header inclusion that could
379 prevent the library from building on some platforms.
383 This version has some important fixes for segfaults when working with corrupt
384 files. All users are strongly encouraged to upgrade.
388 * Fix segfault in utilities due to referencing ColorMaps in GifFiles that had
390 * Fix gif2x11 to work on 24 bit displays.
391 * Fix for giftext segfault when the GifFile does not store a global colormap.
392 * Checks to fail gracefully when an image contains improper LZ codes.
393 * Close file handles on failure in DGifOpenFileHandle()
394 * Checks to operate on files in binary mode on WIN32 as well as MSDOS.
398 * Add checks to make building on Win32 easier.
399 * Allow turning off gl_s, rle, and X11 support from the configure command line.
400 * Fix for finding a 32 bit integer type on some platforms.
401 * Only enable -Wall if we're using gcc.
405 This version fixes some bugs with deallocating ColorMaps. Fix building on
406 several platforms. Fix x86_64 builds to not hang the encoder.
408 * Fix several areas in decoding where we removed a ColorMap from our GifFile
409 but didn't set the pointer to NULL. This could lead to double free's of
411 * Fix a bug in dev2gif.c where we redefined some gl types incorrectly.
412 * Fix a bug in the gif LZW encoder that was triggered on modern 64 bit
414 * Fix building on Windows. Note -- there has been one API changing event for
415 Windows (renaming DrawText to DrawGifText.) This should have conflicted with
416 Windows API and therefore caused the builds to fail previously. If you had
417 it working with DrawText before, apologies, you'll need to change to
418 DrawGifText in your code. This only affects Windows.
419 * Add support for building on The Game Boy Advance. Note: Due to the GBA's
420 limited memory, the API for the GBA uses short's in many places where the
421 other platforms use ints. This shouldn't affect anyone unless you've
422 been able to get an older version of the code to run on GBA and want to
423 start using this version instead. A recompile of your dependent code
424 will be necessary in this case.
428 This version fixes some bugs in the Extension writing code in
429 EGifPutExtensionFirst, Next, and Last. Using these functions, it is possible
430 to output extensions that contain multiple subblocks. Additionally, library
431 code has been updated to use these functions, making it safe to output
432 long Comments, and multi-block extensions read in from another file.
434 * giflib is now hosted on sourceforge with libungif:
435 http://sourceforge.net/projects/libungif
436 * Make the EGifPutExtension{First,Next,Last} family of functions use WRITE
437 so user defined WRITE methods will output them correctly.
438 * Modify EGifSpew and EGifPutComment to use EGifPutExtension{First,Next,Last}
439 so we won't output broken GIFs when dealing with GIFs with multiple
441 * More -Wall fixes revealed while testing on Solaris and FreeBSD.
442 * Updated the gif_lib.html documentation to not use EGifPutExtension when
443 dealing with multiple subblocks. Use EGifPutExtension{First,Next,Last}
445 * Some Windows code from the old CVS repository now available in the windows
446 subdirectory. I don't have a Windows environment to test and maintain this
447 but maybe someone out there will find it useful. Caveat hacker.
451 * Numerous bug fixes from people on the old libungif mailing list.
452 * GIF_ERROR and GIF_MESSAGE are on the deprecation list as they are also
453 utility helper functions rather than essential to the functioning of the
455 * Complete deprecation list is now in the README file
456 * Audited the sources with gcc -Wall. Everything detectable has now been fixed.
457 * Ran the library code through indent.
461 * Merge in many bug fixes that were sent in while I was hiking the
463 * The qprintf methods of the library are now deprecated. Do not use
464 GifQuietPrint or GifQprintf. These should have been pushed out into the
465 utility helper library instead of sitting around in the library proper at
466 the same time as the getarg functions were moved out. Getting rid of these
467 will let us get rid of our dependence on stdarg.h/varargs.h (Which a Gif
468 reading library has no business requiring.)
472 * Several minor memory leaks in error conditions have been plugged.
473 * New Function EGifOpen(void *userData, OutputFunc writeFunc) allows user
474 specified gif writing functions.
475 * Old copyright notices in a few source files have been updated. All library
476 copyrights should now reflect the copyright notice in the COPYING file.
478 Version 4.0.0 -- giflib
479 =======================
480 This version of the giflib library merges Eric Raymond's giflib-3.0 release
481 with the libungif-4.0 release to give people a binary compatible choice
482 between the two libraries and gives me the chance to add bugfixes to giflib
483 that have been incorporated in libungif.
485 PLEASE READ THE FILE PATENT_PROBLEMS BEFORE USING THIS LIBRARY!
489 Major fixes have been made to the code that handles Extensions.
490 Unfortunately, this causes binary incompatibility with giflib-3.0 and
491 libungif-3.x. However, the API is still intact. I am, however, deprecating
492 the use of saveImage[x].Function. Use
493 saveImage[x].ExtensionBlocks[y].Function instead.
497 The following bugs which caused SegFaults have been fixed:
498 * When reading gif files with extensions, DGifSlurp would violate memory.
499 * When closing a gif that had a local colormap, DGifCloseFile would attempt
500 to free the colormap twice.
501 * Fix a potential memory leak in DGifSlurp.
502 * New function DGifOpen to allow specifying a user definable gif reading
507 * Add a new function:
508 GifFileType *DGifOpen(void * userData, InputFunc readFunc)
509 to read the gif image from a user defined input function.
515 Changes from Eric Raymond's libgif
516 ----------------------------------
517 * A new gif encoder that makes uncompressed gifs rather than standard,
518 LZW-compressed gifs. This is actually the major motivating factor behind
519 libungif; to provide third-party distributors a means to provide a gif
520 library without the patented LZW encoder.
521 * A new configure script to make compilation of the library on multiple
522 platforms easier. The package should now build shared libraries on all
523 platforms supported by GNU libtool.
524 * Removed the getarg functions from libgif. These were not part of the
525 public API and only used by the tools in the utils directory so I separated
526 them from the rest of the library.
527 * Fixed a few bugs in the tools in the utils directory.
534 * Incorporated Sirtaj Kang's changes to make both static and shared libs.
535 * All the utility and library docs are HTML now.
536 * The library and relevant utilities are now fully GIF89-aware.
537 * Functions for drawing text and boxes on saved images are documented.
538 * The distribution is now issued under a simple X-Consortium-style license.
539 * Can now generate package RPMs and LSM automatically.
540 * Home page with Web-acessible documentation at http://www.ccil.org/~esr/giflib
544 * Fix giftext to not core dump on a null extension record.
545 * Incorporate Philip VanBaren's change to prevent a core dump in gifasm.
549 * Fixed a core-dump bug in gifcomb revealed by ELF environment in Linux 1.2.13.
553 * Added gifburst tool.
557 * Linux is supported.
561 * Added the gifovly tool, which supports making a composite from several GIF
563 * Used gifovly to implement a full-fledged pasteup program in shell. It's
564 called gifcompose and lives in the util directory.
565 * Added a copy of the GIF89 standard to the doc directory (gif89.txt);
566 also a description of the preferred compression method (lzgif.txt).
570 With this version, development was taken over from Gershon Elber by Eric
571 S. Raymond <esr@snark.thyrsus.com>. Note that I, esr, have pretty much
572 adhered to Gershon's coding style, even though it's quite baroque and DOS-
573 headed by my standards.
577 * New DGifSlurp() and EGifSpew() library entry points allow all GIF-bashing
578 to be done in core on machines with sufficient memory. Writing code to
579 slice'n'dice multiple GIFs in non-sequential ways is now much easier (send
580 kudos and brickbats to esr, small unmarked bills preferred).
581 * The interface has changed somewhat. Members in the GifFileType structure
582 have been renamed and regrouped. This was required for support of the
583 SavedImages member (which enables the new functions mentioned in 1). Also,
584 there is a new data type for allocated color maps and routines to handle
586 * Some minor bugs have been fixed. Most notably, the DGif code now correctly
587 handles the possibility of more than one code block per extension record,
588 as per the GIF spec. It's not clear, however, that anyone ever has or
589 ever will use this feature for anything...
591 New Tools and Options
592 ---------------------
593 * A brand new, ultra-spiffy tool `icon2gif' is included. It assembles named
594 GIFs with editable text color map & icon raster representations to produce
595 multi-image GIFs usable as graphical resource files. It can also dump most
596 GIFs in the same text-only form it parses. This makes it easy to edit GIFs
597 even if you don't have a graphics editor.
598 * The gifclip utility supports a new `-c' (complement) option that allows you
599 to perform an `inverse clip', removing horizontal or vertical bands from an
601 * The gifclrmp utility supports a new `-t' switch for shuffling color index
603 * A new tool `gifcolor' generates test pattern from colormap input.
605 New Documentation and Examples
606 ------------------------------
607 * The documentation has been overhauled completely and translated out of the
608 dialect spoken by the estimable Mr. Elber into something like standard
610 * Two source code files gifspnge.c and giffiltr.c have been added to the
611 util directory. These are GIF copiers that exercise the I/O routines,
612 provided as skeletons for your applications. Read the comments in them
614 * The util Makefile for UNIX has been improved. It now uses the cc/gcc -s
615 option rather than strip(1). There are now separate install productions,
616 so you can test new versions in util before installation for production
617 (the top-level make script still does an install).
621 * GIFFIX - a new tool to attempt and fix broken GIF images. Currently fix
622 images that has EOF prematurely by padding with the darkest color.
623 * Make GIF2BGI display as much as it can considering the mem. avail.
624 * Add -q flag to all tools for quite running scan line number mode.
625 * Fix a (minor!?) bug in the GIF decoder when encountering code 4095.
626 * New tools (RGB2GIF and GIF2RGB) to convert GIF to/from 24 bits RGB images.
627 * New tool GIFROTAT to rotate a gif image by an arbitrary angle.
628 * GifRSize was updated to resize by an arbitrary factor.
632 * GIF2BGI - a new utility to display GIF images using Borland's BGI drivers
634 * TEXT2GIF - Converts plain text into GIF images.
635 * GIF2IRIS - SGI4D display program for GIF images.
636 * GIF_LIB naming convension has been modified to make sure it has unique
637 names (see gif_lib.h).
638 * Support for SGI4D gl and X11 window grabbing has been added to the
639 library. SGI4D input is quantizied into 8 bits.
640 Also support for EGA/VGA devices has been added as well.
641 see Dev2gif.c module.
642 * Support for the new gif89a format has been added.