Commit Graph

1273 Commits

Author SHA1 Message Date
Kim Woelders 9977ac2026 JPG loader: Fix memory leaks in error paths 2019-09-29 19:44:41 +02:00
Kim Woelders 701f87ffa6 WepP loader: Fix memory leak in error path 2019-09-29 18:40:03 +02:00
Kim Woelders 09d9a95054 Remove pointless im->data checks in loaders
im->data should always be NULL when entering the load() function.

We can therefore also remove free(im->data) calls before the buffer
is allocated.
2019-09-29 18:39:56 +02:00
Kim Woelders 3f4d80dc82 Add new WebP loader
Contributed by Jason Andresen <jandrese@vt.edu>.
2019-08-15 15:44:49 +02:00
Kim Woelders 203a99a51a JPG loader: Do proper CMYK conversion 2018-07-22 09:13:43 +02:00
Kim Woelders 1c095fd9be JPG loader: Refactor 2018-07-22 09:13:43 +02:00
Kim Woelders 5051ef9249 XPM loader: More simplifications
In particular, remove redundant and bogus loop conditions.
2018-07-21 15:26:34 +02:00
Kim Woelders 6ea4cf7e66 XPM loader: Add missing pixels (malformed xpm)
If there are not enough pixels in the image data just fill in the first
color.

This way we will proceed without uninitialized pixel data avoiding
valgrind complaints.
2018-07-21 15:25:44 +02:00
Kim Woelders 49a67a8f9c XPM loader: Simplify pixel value handling 2018-07-21 15:25:44 +02:00
Kim Woelders f09c02d193 XPM loader: Fix several colormap issues 2018-07-21 15:25:44 +02:00
Kim Woelders 88c23a8e93 XPM loader: Cosmetics (reduce indent level) 2018-07-21 15:25:44 +02:00
Kim Woelders 4e6d8e8938 Revert "XPM loader: Fix potentially uninitialized pixel data"
This introduced other issues, proper fix coming up..

This reverts commit cbc09c0345.
2018-07-21 15:24:11 +02:00
Kim Woelders 621d498450 XPM loader: Fixup after "Refactor exit cleanup handling"
Don't crash on non-existing file.
2018-07-21 09:00:45 +02:00
Kim Woelders cbc09c0345 XPM loader: Fix potentially uninitialized pixel data
Pixels with color "none" were composed using uninitialised GB values.

Although the pixels were "correct", as RGB are don't-care when A is 0,
let's not put random data in images and avoid valgrind complaints.

Thanks to Sebastien Ballet for test case.
2018-07-20 06:08:56 +02:00
Kim Woelders a2be3c001d XPM loader: Refactor exit cleanup handling 2018-07-20 06:02:42 +02:00
Kim Woelders ae9635b5d7 Fix memory leak in imlib_list_fonts()
Spotted by Sebastien Ballet.
2018-07-18 16:53:54 +02:00
Kim Woelders 5b17b85280 Spec file simlifications and cleanups 2018-07-17 19:31:04 +02:00
Kim Woelders 244cb1ce27 Add new ICO loader 2018-07-17 19:31:04 +02:00
Kim Woelders 89432fff5e Use common PIXEL_ARGB() macro to compose pixels 2018-07-17 19:31:04 +02:00
Kim Woelders 7206a84311 Move SWAP.. macro definitions to common.h 2018-07-17 19:31:04 +02:00
Kim Woelders b2e06bc6bd Remove obsolete dmalloc stuff
Also add some space in macros
2018-07-17 19:31:04 +02:00
Kim Woelders 0f3ebf198a Sort loaders in Makefile.am
Just for tidiness..
2018-07-17 19:31:04 +02:00
Kim Woelders 8fcdc4965d Centralize handling of im->format
Instead of assigning it (in different ways) in each loader, do it
centrally in __imlib_LoadImageWrapper().

And a couple of cleanups in code related to im->format.
2018-07-17 19:31:04 +02:00
Kim Woelders 868a40579a Cleanups in load() functions
When entering load we can assume that im != NULL and im->data == NULL.
2018-07-17 19:31:04 +02:00
Kim Woelders cf2b8e7c3d Add imlib2_test_load program
Just loads/unloads images given on command line.

Useful for loader testing.
2018-07-17 19:31:04 +02:00
Kim Woelders cc7c413655 Trivial cleanups in imlib2_... test programs 2018-07-17 19:31:00 +02:00
Ralph Siemsen 4fc4a6ad77 loader_tga: fix regression in RLE raw byte handling
Commit 6ef51ec4cd added some cleanup
logic, however it introduced an off-by-one bug for raw bytes in RLE.
It looks like a copy'n'paste problem:
- the check on line 426 is correct, however
- the check on line 481 has an erronous "+ 1"
In the second case, "bufptr" has already been incremented, so the
extra "+ 1" is not needed.

This bug causes some legitimate TGA files to fail to load, on the
very last pixel...
2018-05-04 18:58:30 +02:00
Kim Woelders c63f7a3a63 Autofoo cosmetics 2018-05-04 18:15:01 +02:00
Kim Woelders 9e095d5bbe imlib2_conv: Report error on save failure 2018-03-29 07:23:52 +02:00
Kim Woelders 092c05acc3 Add __imlib_LoadImageWrapper() handling all load() calls
Loaders behave inconsistently on error so do cleanups in
__imlib_LoadImageWrapper()
2018-03-29 07:23:48 +02:00
Kim Woelders 78e738612c 1.5.1. 2018-03-17 14:01:55 +01:00
Kim Woelders d0da3117e9 imlib2_conv.c: Fix gcc8 warning
imlib2_conv.c: In function ‘main’:
imlib2_conv.c:64:14: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
              strncpy(p, dot, (strlen(dot) < 9) ? strlen(dot) : 8);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
imlib2_conv.c:64:31: note: length computed here
              strncpy(p, dot, (strlen(dot) < 9) ? strlen(dot) : 8);
                               ^~~~~~~~~~~
2018-03-10 20:25:58 +01:00
Kim Woelders 4d6ff056ef grab.c: Fix gcc8 warning
grab.c: In function ‘__imlib_GrabDrawableToRGBA’:
grab.c:543:32: error: cast between incompatible function types from ‘void (*)(Display *, XErrorEvent *)’ {aka ‘void (*)(struct _XDisplay *, struct <anonymous> *)’} to ‘int (*)(Display *, XErrorEvent *)’ {aka ‘int (*)(struct _XDisplay *, struct <anonymous> *)’} [-Werror=cast-function-type]
    prev_erh = XSetErrorHandler((XErrorHandler) Tmp_HandleXError);
                                ^
2018-03-10 20:25:58 +01:00
Kim Woelders c872826e3b imlib2_view: Limit window dimensions to 32767 2018-03-10 20:25:58 +01:00
Kim Woelders b8ef1561c5 Warning fixes in imlib2_... programs
Use CFLAGS_WARNINGS here too and clean up the warnings (mostly shadow).
2018-03-10 20:25:58 +01:00
Kim Woelders 1c55ef577d Add missing const to imlib_apply_filter() script argument 2018-03-10 20:25:58 +01:00
Kim Woelders bb09d7844e PNG loader: Correct various error handling cases
Under various error conditions the image width would not be set to 0
which is currently required for the loader code to behave properly.

In particular, png_read_end() should not be called in error cases.
This would cause a longjump which would exit without setting im->w to 0.
2018-03-10 20:19:55 +01:00
Kim Woelders a120e3152a Maximum image dimension should be 32767, not 32766
Presumably a glitch from when it last was lowered to "32767".
2018-03-10 20:19:55 +01:00
Kim Woelders 7dc59c88f8 BMP loader: Fix warnings found with -O3 2018-03-09 22:02:31 +01:00
Kim Woelders 42f6004f96 PNM loader: Simplify (fixing ASCII format parsing issues T6751)
ASCII format parsing is considerably simpler/safer now.

P1 (ASCII pbm) case is somewhat slower than before (but more correct).
P2 (ASCII pgm) case is roughly same speed.
P3 (ASCII ppm) case is a bit faster.

https://phab.enlightenment.org/T6751
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=406371
2018-03-09 21:29:30 +01:00
Kim Woelders 51a48ecfe9 BMP loader: Fix infinite loop with invalid bmp images (T6749)
https://phab.enlightenment.org/T6749
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773968
2018-03-07 20:26:21 +01:00
Kim Woelders 5a7644a0c0 XPM loader: Fix potential use of uninitialized value (T6746)
https://phab.enlightenment.org/T6746
https://bugs.debian.org/868151
2018-03-07 19:45:39 +01:00
Kim Woelders 8038d9c618 Fix build without HAVE_X11_SHM_FD (T6752) 2018-03-07 19:44:05 +01:00
Kim Woelders 4311d5f8ad 1.5.0. 2018-02-22 10:37:26 +01:00
Kim Woelders b26c72281f Drop -Waggregate-return
xcb cookie returns trigger this warning.
2018-02-22 10:37:07 +01:00
Kim Woelders 63103ae48c Expose XImage cache control functions 2018-02-17 13:23:13 +01:00
Kim Woelders 5cf3e34ff1 Add imlib_get_cache_used()
And some cosmetics.
2018-02-17 11:56:42 +01:00
Kim Woelders 327f8c0ce4 Refactor the XImage cache
Simpler, faster.
2018-02-10 10:53:42 +01:00
Kim Woelders 6a2e839313 Add IMLIB2_XIMAGE_CACHE_COUNT to enable testing the ximage cache 2018-02-10 10:30:16 +01:00
Kim Woelders 096316b476 Introduce IMLIB2_SHM_OPT to enable overriding/testing SHM modes 2018-02-10 10:30:16 +01:00