summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-ico.c
Commit message (Collapse)AuthorAgeFilesLines
* ICO: assert and assume that the module callbacks are non-NULLFederico Mena Quintero2020-01-071-8/+10
|
* io-ico.c: Don't use gdk-pixbuf-private.hFederico Mena Quintero2018-06-011-29/+23
|
* io-*.c: Use gdk_pixbuf_get_pixels(); don't access the pixels field directlyFederico Mena Quintero2018-06-011-14/+14
|
* ico: Fix potential integer overflowDhiru Kholia2017-11-301-4/+5
| | | | | | | | | | Which relies on undefined behaviour. Instead of checking for an overflowed integer after the fact, check whether the addition would be possible at all. Fixes: CVE-2017-6312 https://bugzilla.gnome.org/show_bug.cgi?id=779012
* io-ico: Add an assertion to clarify buffer managementPhilip Withnall2017-08-031-0/+3
| | | | | | | | | | | The code is correct (the line buffer is set when DecodeHeader() returns successfully with a non-zero-length line), but that’s not at all obvious from the code, and is tripping Coverity up. Add an assertion to make it clearer. Coverity ID: 1400057 https://bugzilla.gnome.org/show_bug.cgi?id=778943
* ico: Return an error when the ICO didn't loadBastien Nocera2017-07-271-1/+10
| | | | | | | | If we don't even read enough data to fill the header, return an error. This doesn't cover everything that could go wrong with the ICO incremental loader, but this is a good first throw. https://bugzilla.gnome.org/show_bug.cgi?id=778204
* ico: Fix icon quality sortingBastien Nocera2017-07-261-2/+2
| | | | | | | Despite the inherited comment, commit 99508c7 sorted the icons by increasing instead of decreasing quality. https://bugzilla.gnome.org/show_bug.cgi?id=785447
* ico: Try to skip over broken icon entriesBastien Nocera2017-07-131-13/+12
| | | | | | | If an icon entry is broken, skip over it, but report the breakage if we could not find a single valid entry. https://bugzilla.gnome.org/show_bug.cgi?id=776040
* ico: Fix possible offset overflowBastien Nocera2017-07-131-1/+3
| | | | | | In case the offset is MAXINT, don't try to get a header size past it. https://bugzilla.gnome.org/show_bug.cgi?id=776040
* ico: Don't use signed ints to do uints offset arithmeticsBastien Nocera2017-07-131-6/+6
| | | | | | | | | | | | | Make sure that the calculations we're doing on unsigned bytes can fit in the target variable by making it a 32-bit unsigned int. As detected by UBSan: io-ico.c:288:26: runtime error: left shift of 146 by 24 places cannot be represented in type 'int' io-ico.c:287:38: runtime error: left shift of 222 by 24 places cannot be represented in type 'int' https://bugzilla.gnome.org/show_bug.cgi?id=776040
* ico: Avoid possible ImageScore overflowBastien Nocera2017-07-131-1/+5
| | | | | | | | | | | Seeing as this is only a comparison, don't try to do arithmetics that could overflow. Detected by UBSan: io-ico.c:204:9: runtime error: signed integer overflow: 2134193699 - -555819298 cannot be represented in type 'int' https://bugzilla.gnome.org/show_bug.cgi?id=776040
* io-ico: Fix option parsing to be locale-independentPhilip Withnall2017-02-171-4/+54
| | | | | | | | | | | | | | sscanf() and strtol() are both locale-dependent. In addition, the return value of sscanf() was not being checked (so it could fail without being noticed), and there was no bounds checking being performed. Bounds checking is now performed, although the bounds have been chosen for conservative backwards-compatibility, and may not be the most appropriate. Coverity CID: 1388522 https://bugzilla.gnome.org/show_bug.cgi?id=776990
* io-ico: Add an assertion to clarify potential NULL pointer dereferencePhilip Withnall2017-02-071-2/+7
| | | | | | | | | | | | | | | | At a first read through, it looks like the call to OneLine() could end up dereferencing context->pixbuf when it’s NULL. However, due to a combination of other checks in the caller, OneLine() will only be called after DecodeHeader() has set context->pixbuf to a valid object. Otherwise, if DecodeHeader() bails with an error, the pixbuf will never be dereferenced. Add a comment trying to explain this, and an assertion which backs it up more rigorously. Coverity ID: 1388531 https://bugzilla.gnome.org/show_bug.cgi?id=777374
* ico: Small coding style cleanupBastien Nocera2016-12-291-3/+1
|
* ico: Fix area-updated coordinatesBastien Nocera2016-12-291-1/+7
| | | | | | | When the icon is constructed bottom to top, the y coordinates were incorrectly computed. https://bugzilla.gnome.org/show_bug.cgi?id=581484
* ico: Fix uninitialised alpha valuesBastien Nocera2016-12-291-1/+6
| | | | | | | | | | As we always create a GdkPixbuf with alpha, even if the original file doesn't have an alpha channel, or a mask, make sure to set the alpha pixel value in all cases, if only to have it overridden if there is a mask present. This makes it possible to use the reference test without having differing alpha values.
* ico: Remove "40" magic numbers everywhereBastien Nocera2016-12-141-14/+16
| | | | And use INFOHEADER_SIZE instead.
* ico: Prefer entries with the largest dimensionsBastien Nocera2016-12-141-7/+17
| | | | Not the largest data size.
* ico: Add comment for 32-bit linesBastien Nocera2016-12-141-0/+1
|
* ico: Add debug for which ico entry is selectedBastien Nocera2016-12-141-1/+5
|
* Fix a typoMatthias Clasen2016-09-121-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=770756
* ico: Be more careful when parsing headersMatthias Clasen2016-08-031-58/+78
| | | | | | | | | | | | | There is some redundancy between the ico directory and the bitmap image header. If the two disagree on the icon dimensions, just toss the image, instead of risking crashes or OOM later. Also add some more debug spew that helped in tracking this down, and make error messages more unique. The commit also includes a test image that has an example of this discrepancy and triggers the early exit. https://bugzilla.gnome.org/show_bug.cgi?id=769170
* modules: implement is_option_supported() for builtin modulesMatthias Clasen2016-08-021-0/+12
| | | | | | | Follow-up to previous commit; implement the new API in the modules we ship that can save pixbufs. https://bugzilla.gnome.org/show_bug.cgi?id=683371
* ico: Always set errorsHanno Boeck2016-08-021-2/+12
| | | | | | | | | | When the ico header turn out to be bad, always set an error when we fail. Otherwise, applications will get confused. This commit also adds an example image with a bad ico header. https://bugzilla.gnome.org/show_bug.cgi?id=768484
* ico: Add all mime types from shared-mime-infoBenjamin Otte2015-10-131-0/+5
| | | | In particular, add the canonical image/vnd.microsoft.icon
* ico: Protect against overflowBenjamin Otte2015-10-131-15/+17
|
* ico: Fix support for 256x256 iconsBastien Nocera2014-10-241-17/+16
| | | | | | | | | | In both loading and saving them. The ico format uses "0" as the width or height to mean 256: https://en.wikipedia.org/wiki/ICO_%28file_format%29#Icon_resource_structure Also add a test for that. https://bugzilla.gnome.org/show_bug.cgi?id=674724
* loaders: Simplify and shorten the loader namesBastien Nocera2014-10-241-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=641106
* Updated FSF's addressDaniel Mustieles2014-01-311-3/+1
|
* Make some string data constMatthias Clasen2013-12-181-6/+6
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=144042
* ico: Skip compressed icon imagesStef Walter2011-12-161-69/+96
| | | | | | | | | | * Previously we were selecting the largest icon image and then failing if it was compressed or it was somehow different than we expected. * Instead we should go back to the next largest and so on and see if there's one we can read. https://bugzilla.gnome.org/show_bug.cgi?id=652498
* Replace the aliasing hacks by -Bsymbolic-functionsMatthias Clasen2010-07-091-4/+0
| | | | This is copying similar changes from glib.
* Include alias header when using built-in loadersColin Walters2010-07-061-0/+4
| | | | | | | | If we're building a loader like png into gdk-pixbuf, we need to include the alias header. Otherwise we get internal PLT entries, which makes make check fail. https://bugzilla.gnome.org/show_bug.cgi?id=623314
* Make it compileMatthias Clasen2010-06-251-2/+1
|
* Allocate a large-enough and maskMatthias Clasen2009-11-271-3/+3
| | | | | We came up short when the image width is not a multiple of 8. Bug 585383, fix by Felix Riemann.
* Include "config.h" instead of <config.h> Command used: find -nameJohan Dahlin2008-06-221-1/+1
| | | | | | | | | | | | 2008-06-21 Johan Dahlin <jdahlin@async.com.br> * *.[ch]: Include "config.h" instead of <config.h> Command used: find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g' Rubberstamped by Mitch and Tim svn path=/trunk/; revision=20669
* Use g_set_error_literal where appropriate. Bug #538640.Christian Persch2008-06-191-68/+68
| | | | svn path=/trunk/; revision=20463
* Add image/x-win-bitmap mimetypeMatthias Clasen2008-06-181-0/+1
| | | | svn path=/trunk/; revision=20451
* Fix a crashMatthias Clasen2008-06-131-1/+24
| | | | svn path=/trunk/; revision=20367
* Fix INCLUDE_ macrosMatthias Clasen2008-05-301-1/+1
| | | | svn path=/trunk/; revision=20259
* Use explicit G_MODULE_EXPORT decoration when building the loader inTor Lillqvist2008-05-271-7/+5
| | | | | | | | | | | | | 2008-05-27 Tor Lillqvist <tml@novell.com> * io-*.c: Use explicit G_MODULE_EXPORT decoration when building the loader in question as a module. * gdk-pixbuf-io.c: Enable included build of the icns and jasper loaders. svn path=/trunk/; revision=20192
* Remove unnecessary NULL checks before g_free(). (#369666, Morten Welinder,Matthias Clasen2007-03-091-4/+2
| | | | | | | | | | | | | 2007-03-09 Matthias Clasen <mclasen@redhat.com> * Everywhere: Remove unnecessary NULL checks before g_free(). (#369666, Morten Welinder, Djihed Afifi) * configure.in: Check for ftw.h svn path=/trunk/; revision=17444
* Add image/x-ico to supported mime types. Fixes bug #393599.Felix Riemann2007-02-271-0/+1
| | | | | | | | | 2007-02-27 Felix Riemann <friemann@svn.gnome.org> * io-ico.c: (fill_info): Add image/x-ico to supported mime types. Fixes bug #393599. svn path=/trunk/; revision=17361
* Enable having some gdk-pixbuf loaders built-in even if loading the othersTor Lillqvist2006-10-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2006-10-11 Tor Lillqvist <tml@novell.com> * configure.in: Enable having some gdk-pixbuf loaders built-in even if loading the others dynamically. Define Automake conditional INCLUDE_FOO for each loader as TRUE if that loader is built-in. See also gdk-pixbuf/ChangeLog. 2006-10-11 Tor Lillqvist <tml@novell.com> Enable having some loaders built-in even if loading the others dynamically. Have loaders in the same order as in configure.in in all places where they are handled/listed. * Makefile.am: Define the STATIC_FOO_LIB and FOO_LIB macros conditionally depending on whether said loader is built-in or not. Use the names libstatic-pixbufloader-foo.la instead of libpixbufloader-static-foo.la for the built-in ones so that the "echo libpixbufloader-*.la" won't match them. * gdk-pixbuf-io.c: Reorganize code as to plumb the built-in loaders also if USE_GMODULE. Don't warn about a missing gdk-pixbuf.loaders file if we have at least one included loader. * gdk-pixbuf-private.h * io-*.c: Don't define a generic MODULE_ENTRY, as we can't use it in the loaders anyway. Each loader needs to check if INCLUDE_foo is defined.
* Check for overflow in one more place. (#313818, Tommi Komulainen)Matthias Clasen2005-08-181-1/+9
| | | | | | | 2005-08-18 Matthias Clasen <mclasen@redhat.com> * io-ico.c (DecodeHeader): Check for overflow in one more place. (#313818, Tommi Komulainen)
* Fix a typo. (#168173, Ivan Wong)Matthias Clasen2005-02-241-1/+1
| | | | | | 2005-02-23 Matthias Clasen <mclasen@redhat.com> * io-ico.c: Fix a typo. (#168173, Ivan Wong)
* Changes to make gdk-pixbuf threadsafe (#157310, #157306, Colin Walters):Matthias Clasen2004-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2004-11-12 Matthias Clasen <mclasen@redhat.com> Changes to make gdk-pixbuf threadsafe (#157310, #157306, Colin Walters): * gdk-pixbuf-io.h (enum GdkPixbufFormatFlags): Add GDK_PIXBUF_FORMAT_THREADSAFE to indicate that an image loader is threadsafe. * gdk-pixbuf-io.c (get_file_formats, _gdk_pixbuf_load_module): Use a lock to make initialization of global data structures threadsafe. * gdk-pixbuf-private.h: * gdk-pixbuf-io.c (_gdk_pixbuf_lock, _gdk_pixbuf_unlock): Auxiliary functions which use another lock to protect threadunsafe image loaders. * gdk-pixbuf-io.c (gdk_pixbuf_real_save): (save_to_callback_with_tmp_file): (gdk_pixbuf_real_save_to_callback): (gdk_pixbuf_new_from_xpm_data): (_gdk_pixbuf_generic_image_load): * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): * gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module): (gdk_pixbuf_loader_close): (gdk_pixbuf_loader_finalize): Use _gdk_pixbuf_lock() and _gdk_pixbuf_unlock(). * io-ani.c, io-bmp.c, io-gif.c, io-ico.c: * io-jpeg.c, io-pcx.c, io-png.c, io-pnm.c: * io-ras.c, io-tga.c, io-wbmp.c, io-xbm.c: * io-xpm.c: Mark as threadsafe. * io-tiff.c: Remove pointless locking, mark as threadunsafe.
* *** empty log message ***Matthias Clasen2004-09-151-0/+8
|
* New functions to disable/enable individual loaders and to obtain licenseMatthias Clasen2004-07-081-0/+1
| | | | | | | | | | | | | | | | | | | | | Wed Jul 7 23:53:58 2004 Matthias Clasen <maclas@gmx.de> * gdk-pixbuf-io.h: * gdk-pixbuf-io.c (gdk_pixbuf_format_is_disabled): * gdk-pixbuf-io.c (gdk_pixbuf_format_set_disabled): * gdk-pixbuf-io.c (gdk_pixbuf_format_get_license): New functions to disable/enable individual loaders and to obtain license information about loaders. * gdk-pixbuf-io.h (GdkPixbufFormat): Add disabled and license fields. * gdk-pixbuf-io.c (_gdk_pixbuf_get_module): * gdk-pixbuf-io.c (_gdk_pixbuf_get_named_module): Skip disabled loaders. * io-*.c: Add license information in the fill_info functions.
* Make it possible to call gdk_pixbuf_loader_set_size (loader, 0, 0) byMatthias Clasen2004-01-071-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | Wed Jan 7 01:17:36 2004 Matthias Clasen <maclas@gmx.de> * gdk-pixbuf-loader.c (gdk_pixbuf_loader_size_func): * gdk-pixbuf-loader.c (gdk_pixbuf_loader_set_size): * gdk-pixbuf-loader.c (gdk_pixbuf_loader_init): Make it possible to call gdk_pixbuf_loader_set_size (loader, 0, 0) by changing the initial values of priv->width/height to -1. * io-tiff.c (tiff_image_parse): * io-ras.c (RAS2State): * io-pnm.c (gdk_pixbuf__pnm_image_load_increment): * io-pcx.c (gdk_pixbuf__pcx_load_increment): * io-jpeg.c (gdk_pixbuf__jpeg_image_load_increment): * io-png.c (png_info_callback): * io-ico.c (DecodeHeader): * io-bmp.c (DecodeHeader): Call size_func once the size is known, even if the module can't make use of the scaling information. If size_func returns 0, don't allocate a pixbuf and return, if necessary with an error. * gdk-pixbuf.h: * gdk-pixbuf-io.c (gdk_pixbuf_get_file_info): A new function to determine the type and size of an image file without loading it completely. (#53725)