GithubHelp home page GithubHelp logo

dentonw / devil Goto Github PK

View Code? Open in Web Editor NEW
440.0 440.0 140.0 18.85 MB

Developer's Image Library (DevIL) is a cross-platform image library utilizing a simple syntax to load, save, convert, manipulate, filter, and display a variety of images with ease. It is highly portable and has been ported to several platforms.

Home Page: http://openil.sourceforge.net/

License: GNU Lesser General Public License v2.1

TeX 0.19% Java 0.82% Shell 0.24% C++ 70.48% Makefile 0.66% C 20.05% C# 0.39% Mathematica 0.17% Pascal 1.08% Fortran 0.01% Python 2.11% NSIS 0.17% CMake 1.39% Batchfile 0.23% Visual Basic .NET 0.32% VBA 1.55% FreeBasic 0.14% SWIG 0.01%

devil's People

Contributors

abma avatar agadoul avatar alexpux avatar bcampbell avatar chaoscat avatar dentonw avatar devnexen avatar dooglz avatar mitchblank avatar pullmoll avatar ramassin avatar s-ludwig avatar shybovycha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

devil's Issues

Split DevIL repositories

Apart from DevIL source code, DevIL repository currently contains docs, utils and test images. These should be split into separate repositories due to many reasons, such as convenience (users who only need DevIL sources won't need to download 200MB of test images) and legal reasons (as you state, test images may contain copyrighted work, so it should not be distributed with DevIL). Split may be done easily with git filter branch, see git help filter-branch, EXAMPLES section, example for --subdirectory-filter.

gcc5 build issue using restrict in C++ code

libtool: compile:  gcc-5 -DHAVE_CONFIG_H -I. -I../include/IL -I ./../src-IL/include -I ./../include -std=gnu99 -fgnu89-inline -msse -msse2 -msse3 -g -O2 -c ./../src-IL/src/il_bits.c -o libIL_la-il_bits.o >/dev/null 2>&1
In file included from ./../src-IL/src/il_exr.cpp:14:0:
./../src-IL/include/il_internal.h:230:54: error: expected ',' or '...' before 'FileName'
 ILboolean ilIsValidBmp(ILconst_string CONST_RESTRICT FileName);
                                                      ^
make[1]: *** [libIL_la-il_exr.lo] Error 1
make[1]: *** Waiting for unfinished jobs....

Homebrew/legacy-homebrew#40442

Workaround found thanks to arpg/SceneGraph#10 (comment)

It seems that NetBSD has been patching this now for a while:
http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/devel/devIL/patches/patch-include_IL_il.h
http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/devel/devIL/patches/patch-include_IL_il.h

The NetBSD patch works on OS X as well, allowing devil to build with gcc5.

Homebrew in-formula patch:

    inreplace "include/IL/il.h",
      "#ifdef RESTRICT_KEYWORD",
      "#if defined(RESTRICT_KEYWORD) && !defined(__cplusplus)"

ilActiveImage() is unclear

I've run into an oddity with ilActiveImage(), the function for switching between frames in a multi-frame image.
I would have assumed that you could iterate through frames like this:

int numFrames = ilGetInteger(IL_NUM_IMAGES);
for (i=0; i<numFrames; ++i) {
    ilActiveImage(i);
    ... do stuff to the frame ...
}

However, this doesn't do what you'd probably expect. Instead, it skips though frames 0,1,2,4,8,16 etc... until it runs off the end.
This is because it jumps to the Nth frame of the current image, rather than the root image (frame 0).

I'm pretty sure this is a bug, but I thought I should make sure before I fix it...

The cmake build (on OS X) produces different set of binaries (and with different names) compared to the auto tools build

The cmake build produces and installs (on OS X):

  • include/IL/il.h
  • INSTALL_RECEIPT.json
  • lib/libDevIL.dylib
  • README.md

while the auto tools script produces:

  • AUTHORS
  • bin/ilur
  • ChangeLog
  • COPYING
  • include/IL/devil_cpp_wrapper.hpp
  • include/IL/il.h
  • include/IL/ilu.h
  • include/IL/ilu_region.h
  • include/IL/ilut.h
  • INSTALL_RECEIPT.json
  • lib/libIL.1.dylib
  • lib/libIL.a
  • lib/libIL.dylib
  • lib/libILU.1.dylib
  • lib/libILU.a
  • lib/libILU.dylib
  • lib/libILUT.1.dylib
  • lib/libILUT.a
  • lib/libILUT.dylib
  • lib/pkgconfig/IL.pc
  • lib/pkgconfig/ILU.pc
  • lib/pkgconfig/ILUT.pc
  • NEWS
  • README
  • share/info/DevIL_manual.info
  • TODO

I'd ultimately like the cake build to produce exactly the same output as the auto tools one but for starters would like just the name of the libraries to be the same.

CMake's find_package() interoperability?

I've been trying to link to a DevIL installation to /usr/local/lib. In there there is a cmake/ folder with some files for different packages. I think find_package() defaults to these files. DevIL does not add itself to this folder.

I believe the following two files are involved, and possibly the whole of the story. They are copied somehow by the "install" make target.

https://github.com/bulletphysics/bullet3/blob/master/UseBullet.cmake
https://github.com/bulletphysics/bullet3/blob/master/BulletConfig.cmake.in

I can find DevIL with CMake's pkg_check_modules() instead. However pkg-config doesn't look inside the /usr/local folder by default. I know its path can be set with its --define-variable option, but in general I'm having a hell of a time to try to get pkg-config to look in /usr/local. I think it's designed for packages released via normal channels; so I think this other pathway should be used. CMake does look in /usr/local/lib/cmake.

Right now I made a symlink from /lib/pkgconfig/IL.pc to the /usr/local one.

(I will try to help if I can. I'm trying figure this out myself. I inherit DevIL via the old COLLADA-DOM project. And the Bullet library also.)

P.S. I recently installed the Sourceforge.net files. They were a headache to make work requiring many manual fixes. The files here (once I found them) went off without a hitch. I think the release versions are the same.

What about the BSD license change?

Hi,

the Love2d engine uses DevIL and it would be nice if it was possible to release games as one exe. However, due to the LGPL licensing of DevIL that would be only possible if I made the whole game GPL-licensed. On the website, it appears you received requests for BSD licensing of DevIL before. Anything that resulted from those? Any chance you will actually switch to BSD-style licensing?

Regards,

undefined reference to `ilutGLScreen'

Hi,
I've just migrated to the git version with the cmake build changes and I am struggling a bit to find my way round the changes. I am running on an Arch Linux system and I have freeglut installed. The output from cmake .. is;

DevIL, 64 bit compiler detected
-- Could not find libSquish
64 bit compiler detected
64 bit compiler detected
-- Could NOT find cppunit (missing: CPPUNIT_LIBRARY CPPUNIT_INCLUDE_DIR)
-- UnitTest disabled, cppunit wasn't found!
-- Configuring done
-- Generating done
-- Build files have been written to: /home/john-antergos/Software/DevIL.git/DevIL/build

When I build the libraries I see no reference to ilutGLScreen. When I link I get an undefined reference to ilutGLScreen. There is an ilut.so but no ilutGLScreen symbol defined in it. When I look at the symbols in ilut_opengl.cpp.o there were none. From that I assume that ILUT_USE_OPENGL is not defined. I checked in ilut_config.h and it is defined there.
I am at a loss as to how to build with opengl support . Any help would be appreciated.
Thanks

CMake compile error

Hello

Something has changed recently, as I can't compile master anymore.
I have a git pull (4a2d782) which compile without any problems, but current HEAD doesn't.

[kristian@arch-hp-laptop build]$ cmake ..
-- The C compiler identification is GNU 6.3.1
-- The CXX compiler identification is GNU 6.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
DevIL, 64 bit compiler detected
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11") 
-- Found PNG: /usr/lib64/libpng.so (found version "1.6.28") 
-- Found JPEG: /usr/lib64/libjpeg.so  
-- Found TIFF: /usr/lib64/libtiff.so (found version "4.0.7") 
-- Found Jasper: /usr/lib64/libjasper.so (found version "2.0.10") 
-- Could not find libSquish
CMake Warning at src-IL/CMakeLists.txt:106 (find_package):
  By not providing "FindNVTT.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "NVTT", but
  CMake did not find one.

  Could not find a package configuration file provided by "NVTT" with any of
  the following names:

    NVTTConfig.cmake
    nvtt-config.cmake

  Add the installation prefix of "NVTT" to CMAKE_PREFIX_PATH or set
  "NVTT_DIR" to a directory containing one of the above files.  If "NVTT"
  provides a separate development package or SDK, be sure it has been
  installed.


CMake Warning at src-IL/CMakeLists.txt:112 (find_package):
  By not providing "FindOpenEXR.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OpenEXR", but
  CMake did not find one.

  Could not find a package configuration file provided by "OpenEXR" with any
  of the following names:

    OpenEXRConfig.cmake
    openexr-config.cmake

  Add the installation prefix of "OpenEXR" to CMAKE_PREFIX_PATH or set
  "OpenEXR_DIR" to a directory containing one of the above files.  If
  "OpenEXR" provides a separate development package or SDK, be sure it has
  been installed.


-- Found LCMS2: /usr/lib64/liblcms2.so  
 
64 bit compiler detected
 
64 bit compiler detected
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/DevIL/DevIL/build
[kristian@arch-hp-laptop build]$ make
Scanning dependencies of target IL
[  0%] Building CXX object src-IL/CMakeFiles/IL.dir/src/altivec_common.cpp.o
[  1%] Building CXX object src-IL/CMakeFiles/IL.dir/src/altivec_typeconversion.cpp.o
[  2%] Building CXX object src-IL/CMakeFiles/IL.dir/src/il_alloc.cpp.o
[  3%] Building CXX object src-IL/CMakeFiles/IL.dir/src/il_bits.cpp.o
[  4%] Building CXX object src-IL/CMakeFiles/IL.dir/src/il_blp.cpp.o
[  5%] Building CXX object src-IL/CMakeFiles/IL.dir/src/il_bmp.cpp.o
[  6%] Building CXX object src-IL/CMakeFiles/IL.dir/src/il_convbuff.cpp.o
[  7%] Building CXX object src-IL/CMakeFiles/IL.dir/src/il_convert.cpp.o
[  8%] Building CXX object src-IL/CMakeFiles/IL.dir/src/il_cut.cpp.o
[  8%] Building CXX object src-IL/CMakeFiles/IL.dir/src/il_dcx.cpp.o
[  9%] Building CXX object src-IL/CMakeFiles/IL.dir/src/il_dds-save.cpp.o
[ 10%] Building CXX object src-IL/CMakeFiles/IL.dir/src/il_dds.cpp.o
/tmp/DevIL/DevIL/src-IL/src/il_dds.cpp:635:28: fejl: »_In_« was not declared in this scope
 static size_t BitsPerPixel(_In_ DXGI_FORMAT fmt)
                            ^~~~
make[2]: *** [src-IL/CMakeFiles/IL.dir/build.make:327: src-IL/CMakeFiles/IL.dir/src/il_dds.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:86: src-IL/CMakeFiles/IL.dir/all] Error 2
make: *** [Makefile:128: all] Error 2

Link Error, Can't build Lib (Windows, VS2015, cmake)

In DevIL\include\IL\il.h the macro on line 58 checks for _IL_BUILD_LIBRARY, if not defined, DevIL.lib is linked. During the build process this causes Devil to try and link itself, as _IL_BUILD_LIBRARY is not defined in il.h (il_interal.h or something else is not included).
Resulting in : "Error LNK1104 cannot open file 'DevIL.lib"
This is with VS2015, building for Win10 x64, using cmake to generate the project.

Invalid read / SIGSEGV

Following sample file crashes libdevil. The bug was found using examples/simple_example/simple.c with the sample file as input. Sample input file is fuzzed with american fuzzy lop http://lcamtuf.coredump.cx/afl/.

sample file hexdump:

00000000  00 0c 01 01 00 01 40 00  fe ff ff ff ff 80 1b ff  |......@.........|
00000010  0f ec ec ec 00 43 01 fc  ff fd 00 6d 00 0b 08 00  |.....C.....m....|
00000020  00 80 12 16 fe 01 ec 00  02 ff 0c 22 e7 e7 02 00  |..........."....|
00000030  00 01 fc e3 7f ff ff 14  16 fe 01 ec ff 00 0b 08  |................|
00000040  00 00 02 00 83 05 00 00  40 20 ff 7f 12 00 00 00  |........@ ......|
00000050  24 01 ec ff 00 0b 08 00  00 ec 01 01 00 00 00 00  |$...............|
00000060  00 00 00 0c 08 00 00 00  20 ec 01 ed 0a f4 ff 00  |........ .......|
00000070  80 00 ff ff ff 0c 00 14  02 00 83 0c 00 00 40 00  |..............@.|
00000080  00 9d 12 16 fe 01 ec ff  ff ff 0c 72 ef db 00 43  |...........r...C|
00000090  00 01 ec 01 ed 0a f4 ff  0c 00 00 ff ff ff 00     |...............|
0000009f

How to reproduce:

# clang -o simple examples/simple_example/simple.c -lIL -lILU -lILUT
# ./simple <sample-file>

gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff73dd49f in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff73dd49f in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6
#1  0x00007ffff78b2f6f in iFlipNewBuffer () from build/lib/x64/libIL.so
#2  0x00007ffff78b3090 in iGetFlipped () from build/lib/x64/libIL.so
#3  0x00007ffff78d59d1 in iSaveTargaInternal() () from build/lib/x64/libIL.so
#4  0x00007ffff78d5486 in ilSaveTargaF () from build/lib/x64/libIL.so
#5  0x00007ffff78d5418 in ilSaveTarga () from build/lib/x64/libIL.so
#6  0x00007ffff78ad961 in ilSaveImage () from build/lib/x64/libIL.so
#7  0x00000000004011c1 in main (argc=2, argv=0x7fffffffe5c8) at examples/simple_example/simple.c:83

valgrind:

==25690== Memcheck, a memory error detector                                                  
==25690== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==25690== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==25690== Command: build/lib/x64/simple findings/crashes/id:000002,sig:11,src:000008+000007,op:splice,rep:128
==25690== 
Width: 33023  Height: 65307  Depth: 1  Bpp: 16
==25690== Invalid read of size 8
==25690==    at 0x4C319BE: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25690==    by 0x50AEF6E: iFlipNewBuffer (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50AF08F: iGetFlipped (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D19D0: iSaveTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1485: ilSaveTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1417: ilSaveTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A9960: ilSaveImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x4011C0: main (simple.c:83)
==25690==  Address 0xb6e9810 is 6 bytes after a block of size 18,298,826 alloc'd
==25690==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25690==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5091B77: ilInitImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5091FE3: ilTexImage_ (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5091E62: ilTexImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D0933: iReadColMapTga(TARGAHEAD*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D0764: iLoadTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D0675: ilLoadTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D061C: ilLoadTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A7475: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690== 
==25690== Invalid read of size 8
==25690==    at 0x4C319B0: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25690==    by 0x50AEF6E: iFlipNewBuffer (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50AF08F: iGetFlipped (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D19D0: iSaveTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1485: ilSaveTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1417: ilSaveTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A9960: ilSaveImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x4011C0: main (simple.c:83)
==25690==  Address 0xb6e9820 is 22 bytes after a block of size 18,298,826 alloc'd
==25690==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25690==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5091B77: ilInitImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5091FE3: ilTexImage_ (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5091E62: ilTexImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D0933: iReadColMapTga(TARGAHEAD*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D0764: iLoadTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D0675: ilLoadTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D061C: ilLoadTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A7475: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690== 
==25690== Invalid write of size 8
==25690==    at 0x4C319B3: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25690==    by 0x50AEF6E: iFlipNewBuffer (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50AF08F: iGetFlipped (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D19D0: iSaveTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1485: ilSaveTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1417: ilSaveTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A9960: ilSaveImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x4011C0: main (simple.c:83)
==25690==  Address 0xb6e9808 is 18,298,824 bytes inside a block of size 18,298,826 alloc'd
==25690==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25690==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5091B77: ilInitImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5091FE3: ilTexImage_ (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5091E62: ilTexImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D0933: iReadColMapTga(TARGAHEAD*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D0764: iLoadTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D0675: ilLoadTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D061C: ilLoadTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A7475: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690== 
==25690== Invalid write of size 2
==25690==    at 0x4C31A0B: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25690==    by 0x50AEF6E: iFlipNewBuffer (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50AF08F: iGetFlipped (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D19D0: iSaveTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1485: ilSaveTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1417: ilSaveTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A9960: ilSaveImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x4011C0: main (simple.c:83)
==25690==  Address 0xa568660 is 4,016,496 bytes inside an unallocated block of size 4,072,176 in arena "client"
==25690== 
==25690== Invalid read of size 2
==25690==    at 0x4C31A17: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25690==    by 0x50AEF6E: iFlipNewBuffer (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50AF08F: iGetFlipped (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D19D0: iSaveTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1485: ilSaveTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1417: ilSaveTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A9960: ilSaveImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x4011C0: main (simple.c:83)
==25690==  Address 0xc85d80a is 0 bytes after a block of size 18,298,826 alloc'd
==25690==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25690==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50AEECE: iFlipNewBuffer (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50AF08F: iGetFlipped (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D19D0: iSaveTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1485: ilSaveTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1417: ilSaveTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A9960: ilSaveImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x4011C0: main (simple.c:83)
==25690== 
==25690== Invalid read of size 2
==25690==    at 0x4C31A08: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25690==    by 0x50AEF6E: iFlipNewBuffer (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50AF08F: iGetFlipped (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D19D0: iSaveTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1485: ilSaveTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1417: ilSaveTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A9960: ilSaveImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x4011C0: main (simple.c:83)
==25690==  Address 0xc85d80e is 4 bytes after a block of size 18,298,826 alloc'd
==25690==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25690==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50AEECE: iFlipNewBuffer (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50AF08F: iGetFlipped (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D19D0: iSaveTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1485: ilSaveTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1417: ilSaveTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A9960: ilSaveImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x4011C0: main (simple.c:83)
==25690== 
==25690== 
==25690== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==25690==  Access not within mapped region at address 0xC85E000
==25690==    at 0x4C31A17: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25690==    by 0x50AEF6E: iFlipNewBuffer (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50AF08F: iGetFlipped (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D19D0: iSaveTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1485: ilSaveTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50D1417: ilSaveTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x50A9960: ilSaveImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25690==    by 0x4011C0: main (simple.c:83)
==25690==  If you believe this happened as a result of a stack
==25690==  overflow in your program's main thread (unlikely but
==25690==  possible), you can try to increase the size of the
==25690==  main thread stack using the --main-stacksize= flag.
==25690==  The main thread stack size used in this run was 8388608.
==25690== 
==25690== HEAP SUMMARY:
==25690==     in use at exit: 36,625,226 bytes in 96 blocks
==25690==   total heap usage: 105 allocs, 9 frees, 36,712,348 bytes allocated
==25690== 
==25690== LEAK SUMMARY:
==25690==    definitely lost: 0 bytes in 0 blocks
==25690==    indirectly lost: 0 bytes in 0 blocks
==25690==      possibly lost: 160 bytes in 2 blocks
==25690==    still reachable: 36,625,066 bytes in 94 blocks
==25690==         suppressed: 0 bytes in 0 blocks
==25690== Rerun with --leak-check=full to see details of leaked memory
==25690== 
==25690== For counts of detected and suppressed errors, rerun with: -v
==25690== ERROR SUMMARY: 8718 errors from 6 contexts (suppressed: 0 from 0)

Confusion over Bpp and Bpc

Hey Devs, I've noticed some inconsistency in the handling of ILimage members Bpc and Bpp.

For instance, after creating an ilImage(filename.exr), the image object had a Bpp of 16, where the file object was an RGBA float. Of course, this would be correct if Bpp meant 'bytes per pixel'. However, 'devil_internal_exports.h' indicates that this is actually the number of channels per pixel.

Perhaps this is an inconsistency between the cpp wrapper and the base c implementation. For instance, I added support for 'Blit' in the cpp, and found that it couldn't properly handle the above file. It doesn't seem to handle the float type properly

Anyway, I can provide a diff for the Blit func if you like.

Optionally include ILU and ILUT

It'd be good if we could optionally include/exclude building ILU and ILUT like we do for IL_TESTS. It could be useful when using add_subdirectory to add DevIL.

I can make these changes if you think they make sense.

cast from 'ILubyte* {aka unsigned char*}' to 'ILint {aka int}' loses precision

Hello

I get the following, when trying to compile DevIL from ArchLinux.

git clone [email protected]:DentonW/DevIL.git
cd DevIL/DevIL
cmake .
make
[  1%] Building CXX object src-IL/CMakeFiles/IL.dir/src/il_rle.cpp.o
/home/kristian/Hentninger/DevIL/DevIL/src-IL/src/il_rle.cpp: In function 'ILboolean ilRleCompressLine(ILubyte*, ILuint, ILubyte, ILubyte*, ILuint*, ILenum)':
/home/kristian/Hentninger/DevIL/DevIL/src-IL/src/il_rle.cpp:20:52: error: cast from 'ILubyte* {aka unsigned char*}' to 'ILint {aka int}' loses precision [-fpermissive]
  const ILint bmp_pad_to_even = (ILint)(1 - ((ILint)q - *DestWidth) % 2);
                                                    ^
make[2]: *** [src-IL/CMakeFiles/IL.dir/build.make:1479: src-IL/CMakeFiles/IL.dir/src/il_rle.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:86: src-IL/CMakeFiles/IL.dir/all] Error 2
make: *** [Makefile:128: all] Error 2

Removing the q, seems to fix it, but I'm not sure if that yields other problems?

Regards Kristian

Issue in Rotating Non Square Images 90 degrees

I am trying to rotate an image (height greater than width) 90 degree. In the below code it crashes in the function "ILAPI ILimage* ILAPIENTRY iluRotate_(ILimage *Image, ILfloat Angle)".

Consider the image width = 50, and height = 100. So when X=0, Y = 50, RotOffset will be "-1" after executing "RotOffset = x * Rotated->Bps + (Image->Width - 1 - y) * Rotated->Bpp;" Since "RotOffset " is unsigned int, subsequent array access "Rotated->Data[RotOffset + c]" will fail.

Error in installation!

Can somebody help me? I have spent two days to solve the problem, but i failed.

/usr/bin/ld: /usr/local/lib/libpng.a(png.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpng.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
src-IL/CMakeFiles/IL.dir/build.make:2104: recipe for target 'lib/x64/libIL.so' failed
make[2]: *** [lib/x64/libIL.so] Error 1
CMakeFiles/Makefile2:85: recipe for target 'src-IL/CMakeFiles/IL.dir/all' failed
make[1]: *** [src-IL/CMakeFiles/IL.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2

The auto tools build on OS X is broken after the latest changes related to the cmake build

The build is failing with the following error:

libtool: compile: gcc-6 -DHAVE_CONFIG_H -I. -I../include/IL -I ./../src-IL/include -I ./../include -std=gnu99 -fgnu89-inline -msse -msse2 -msse3 -g -O2 -c ./../src-IL/src/il_convert.c -fno-common -DPIC -o .libs/libIL_la-il_convert.o
./../src-IL/src/il_wdp.c:24:21: fatal error: WMPGlue.h: No such file or directory
#include <WMPGlue.h>

The above seems to be caused by the removal of the following lines from DevIL/src-IL/include/il_internal.h

#ifndef _WIN32
// The Microsoft HD Photo Device Porting Kit has not been ported to anything other
// than Windows yet, so we disable this if Windows is not the current platform.
#define IL_NO_WDP
#endif//_WIN32

Double free or corruption

Following sample file crashes libdevil. The bug was found using examples/simple_example/simple.c with the sample file as input. Sample pnm input file is fuzzed with american fuzzy lop http://lcamtuf.coredump.cx/afl/.

sample file hexdump:

00000000  50 35 0a 39 45 20 31 36  0a 32 35 35 00 01 00 02  |P5.9E 16.255....|
00000010  00 00 ff ff fc ff 01 00  04 00 00 00 00 ff fe ff  |................|
00000020  01 fe fd ff fc ff ff ff  ff 7f 00 23 01 00 00 00  |...........#....|
00000030  ff 04 f8 ff ff ff 00 00  00 16 00 01 05 00 00 01  |................|
00000040  00 00 06 00 01 00 05 01  00 00 00 02 00 00 98 02  |................|
00000050  00 02 e2 ff ff ff 02 00  01 00 02 00 01 01 00 01  |................|
00000060  00 00 04 00 00 02 00 00  02 00 00 02              |............|
0000006c

How to reproduce:

# clang -o simple examples/simple_example/simple.c -lIL -lILU -lILUT
# ./simple <sample-file>

gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff732aa14 in free () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff732aa14 in free () from /usr/lib/libc.so.6
#1  0x00007ffff78792d0 in DefaultFreeFunc(void const*) () from build/lib/x64/libIL.so
#2  0x00007ffff78791e9 in ifree () from build/lib/x64/libIL.so
#3  0x00007ffff78ce3a8 in ilCloseImage () from build/lib/x64/libIL.so
#4  0x00007ffff78cf01e in ilShutDown () from build/lib/x64/libIL.so
#5  0x00007ffff78cef59 in ilShutDownInternal() () from build/lib/x64/libIL.so
#6  0x00007ffff72e46c0 in __run_exit_handlers () from /usr/lib/libc.so.6
#7  0x00007ffff72e471a in exit () from /usr/lib/libc.so.6
#8  0x00007ffff72ce518 in __libc_start_main () from /usr/lib/libc.so.6
#9  0x0000000000400f1a in _start ()

valgrind:

==15537== Memcheck, a memory error detector                                                  
==15537== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==15537== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==15537== Command: build/lib/x64/simple findings/crashes/id:000000,sig:11,src:000009,op:flip1,pos:3
==15537== 
==15537== Invalid read of size 1
==15537==    at 0x50BC526: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Address 0xa18ff6c is 12 bytes inside a block of size 168 free'd
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BD54E: ilReadBinaryPpm(PPMINFO*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC4FE: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Block was alloc'd at
==15537==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5091C20: ilNewImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50C9FAD: ilGenImages (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010B7: main (simple.c:58)
==15537== 
==15537== Invalid write of size 4
==15537==    at 0x50BC53E: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Address 0xa18ff88 is 40 bytes inside a block of size 168 free'd
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BD54E: ilReadBinaryPpm(PPMINFO*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC4FE: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Block was alloc'd at
==15537==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5091C20: ilNewImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50C9FAD: ilGenImages (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010B7: main (simple.c:58)
==15537== 
Could not open file...exiting.
==15537== Invalid read of size 8
==15537==    at 0x50CA390: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CB01D: ilShutDown (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CAF58: ilShutDownInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x55F56BF: __run_exit_handlers (in /usr/lib/libc-2.25.so)
==15537==    by 0x55F5719: exit (in /usr/lib/libc-2.25.so)
==15537==    by 0x55DF517: (below main) (in /usr/lib/libc-2.25.so)
==15537==  Address 0xa18ff78 is 24 bytes inside a block of size 168 free'd
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BD54E: ilReadBinaryPpm(PPMINFO*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC4FE: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Block was alloc'd at
==15537==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5091C20: ilNewImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50C9FAD: ilGenImages (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010B7: main (simple.c:58)
==15537== 
==15537== Invalid read of size 8
==15537==    at 0x50CA3B8: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CB01D: ilShutDown (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CAF58: ilShutDownInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x55F56BF: __run_exit_handlers (in /usr/lib/libc-2.25.so)
==15537==    by 0x55F5719: exit (in /usr/lib/libc-2.25.so)
==15537==    by 0x55DF517: (below main) (in /usr/lib/libc-2.25.so)
==15537==  Address 0xa18ff98 is 56 bytes inside a block of size 168 free'd
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BD54E: ilReadBinaryPpm(PPMINFO*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC4FE: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Block was alloc'd at
==15537==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5091C20: ilNewImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50C9FAD: ilGenImages (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010B7: main (simple.c:58)
==15537== 
==15537== Invalid read of size 8
==15537==    at 0x50CA3FF: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CB01D: ilShutDown (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CAF58: ilShutDownInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x55F56BF: __run_exit_handlers (in /usr/lib/libc-2.25.so)
==15537==    by 0x55F5719: exit (in /usr/lib/libc-2.25.so)
==15537==    by 0x55DF517: (below main) (in /usr/lib/libc-2.25.so)
==15537==  Address 0xa18ffb8 is 88 bytes inside a block of size 168 free'd
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BD54E: ilReadBinaryPpm(PPMINFO*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC4FE: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Block was alloc'd at
==15537==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5091C20: ilNewImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50C9FAD: ilGenImages (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010B7: main (simple.c:58)
==15537== 
==15537== Invalid read of size 8
==15537==    at 0x50CA427: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CB01D: ilShutDown (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CAF58: ilShutDownInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x55F56BF: __run_exit_handlers (in /usr/lib/libc-2.25.so)
==15537==    by 0x55F5719: exit (in /usr/lib/libc-2.25.so)
==15537==    by 0x55DF517: (below main) (in /usr/lib/libc-2.25.so)
==15537==  Address 0xa18ffc0 is 96 bytes inside a block of size 168 free'd
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BD54E: ilReadBinaryPpm(PPMINFO*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC4FE: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Block was alloc'd at
==15537==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5091C20: ilNewImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50C9FAD: ilGenImages (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010B7: main (simple.c:58)
==15537== 
==15537== Invalid read of size 8
==15537==    at 0x50CA44F: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CB01D: ilShutDown (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CAF58: ilShutDownInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x55F56BF: __run_exit_handlers (in /usr/lib/libc-2.25.so)
==15537==    by 0x55F5719: exit (in /usr/lib/libc-2.25.so)
==15537==    by 0x55DF517: (below main) (in /usr/lib/libc-2.25.so)
==15537==  Address 0xa18ffb0 is 80 bytes inside a block of size 168 free'd
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BD54E: ilReadBinaryPpm(PPMINFO*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC4FE: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Block was alloc'd at
==15537==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5091C20: ilNewImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50C9FAD: ilGenImages (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010B7: main (simple.c:58)
==15537== 
==15537== Invalid read of size 8
==15537==    at 0x50CA477: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CB01D: ilShutDown (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CAF58: ilShutDownInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x55F56BF: __run_exit_handlers (in /usr/lib/libc-2.25.so)
==15537==    by 0x55F5719: exit (in /usr/lib/libc-2.25.so)
==15537==    by 0x55DF517: (below main) (in /usr/lib/libc-2.25.so)
==15537==  Address 0xa18ffc8 is 104 bytes inside a block of size 168 free'd
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BD54E: ilReadBinaryPpm(PPMINFO*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC4FE: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Block was alloc'd at
==15537==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5091C20: ilNewImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50C9FAD: ilGenImages (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010B7: main (simple.c:58)
==15537== 
==15537== Invalid read of size 8
==15537==    at 0x50CA49F: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CB01D: ilShutDown (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CAF58: ilShutDownInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x55F56BF: __run_exit_handlers (in /usr/lib/libc-2.25.so)
==15537==    by 0x55F5719: exit (in /usr/lib/libc-2.25.so)
==15537==    by 0x55DF517: (below main) (in /usr/lib/libc-2.25.so)
==15537==  Address 0xa18ffd0 is 112 bytes inside a block of size 168 free'd
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BD54E: ilReadBinaryPpm(PPMINFO*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC4FE: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Block was alloc'd at
==15537==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5091C20: ilNewImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50C9FAD: ilGenImages (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010B7: main (simple.c:58)
==15537== 
==15537== Invalid read of size 8
==15537==    at 0x50CA4D8: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CB01D: ilShutDown (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CAF58: ilShutDownInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x55F56BF: __run_exit_handlers (in /usr/lib/libc-2.25.so)
==15537==    by 0x55F5719: exit (in /usr/lib/libc-2.25.so)
==15537==    by 0x55DF517: (below main) (in /usr/lib/libc-2.25.so)
==15537==  Address 0xa18ffe0 is 128 bytes inside a block of size 168 free'd
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BD54E: ilReadBinaryPpm(PPMINFO*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC4FE: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Block was alloc'd at
==15537==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5091C20: ilNewImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50C9FAD: ilGenImages (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010B7: main (simple.c:58)
==15537== 
==15537== Invalid read of size 8
==15537==    at 0x50CA528: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CB01D: ilShutDown (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CAF58: ilShutDownInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x55F56BF: __run_exit_handlers (in /usr/lib/libc-2.25.so)
==15537==    by 0x55F5719: exit (in /usr/lib/libc-2.25.so)
==15537==    by 0x55DF517: (below main) (in /usr/lib/libc-2.25.so)
==15537==  Address 0xa18fff8 is 152 bytes inside a block of size 168 free'd
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BD54E: ilReadBinaryPpm(PPMINFO*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC4FE: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Block was alloc'd at
==15537==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5091C20: ilNewImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50C9FAD: ilGenImages (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010B7: main (simple.c:58)
==15537== 
==15537== Invalid free() / delete / delete[] / realloc()
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CB01D: ilShutDown (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CAF58: ilShutDownInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x55F56BF: __run_exit_handlers (in /usr/lib/libc-2.25.so)
==15537==    by 0x55F5719: exit (in /usr/lib/libc-2.25.so)
==15537==    by 0x55DF517: (below main) (in /usr/lib/libc-2.25.so)
==15537==  Address 0xa18ff60 is 0 bytes inside a block of size 168 free'd
==15537==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752CF: DefaultFreeFunc(void const*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50751E8: ifree (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50CA590: ilCloseImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BD54E: ilReadBinaryPpm(PPMINFO*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC4FE: iLoadPnmInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC1C5: ilLoadPnmF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50BC16C: ilLoadPnm (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A7665: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010C8: main (simple.c:64)
==15537==  Block was alloc'd at
==15537==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15537==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x5091C20: ilNewImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x50C9FAD: ilGenImages (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==15537==    by 0x4010B7: main (simple.c:58)
==15537== 
==15537== 
==15537== HEAP SUMMARY:
==15537==     in use at exit: 32 bytes in 1 blocks
==15537==   total heap usage: 102 allocs, 102 frees, 110,192 bytes allocated
==15537== 
==15537== LEAK SUMMARY:
==15537==    definitely lost: 0 bytes in 0 blocks
==15537==    indirectly lost: 0 bytes in 0 blocks
==15537==      possibly lost: 0 bytes in 0 blocks
==15537==    still reachable: 32 bytes in 1 blocks
==15537==         suppressed: 0 bytes in 0 blocks
==15537== Rerun with --leak-check=full to see details of leaked memory
==15537== 
==15537== For counts of detected and suppressed errors, rerun with: -v
==15537== ERROR SUMMARY: 12 errors from 12 contexts (suppressed: 0 from 0)

Use installation path's

On Haiku we use multiple architectures, gcc2 hybrid (gcc2/gcc5) isn't supported, but if we want to build DevIL for a x86 build (gcc5) we need to set it to a $secondaryArchSuffix
It would be nice to be able to use an option like "-DCMAKE_INSTALL_LIB=$path" (where $path for instance would be $libDir in Haiku's case which points to .../system/lib/x86 instead of ... /system/lib
For the include path it would be handy too.
At this moment we have a working version, but it's a bit hacky into moving the libs and headers into the proper place:
https://github.com/Begasus/haikuports/blob/39d3409800d881ddbc0eb325b7a1fac3dc50f13c/media-libs/devil/devil-1.8.0.recipe
Thanks in advance! :)

devil configured without --enable-ILUT still refers to <IL/ilut.h> in devil_cpp_wrapper.hpp

When built without "--enable-ILUT", if you try to compile

#include <IL/devil_cpp_wrapper.hpp>
int main() {
  ilImage image;
  return 0;
}

the following error occurs:

bash-3.2$ /usr/bin/clang++ test.cpp -L/usr/local/Cellar/devil/HEAD/lib -lIL -lILU -o test
In file included from test.cpp:1:
/usr/local/include/IL/devil_cpp_wrapper.hpp:4:10: fatal error: 'IL/ilut.h' file not found
#include <IL/ilut.h>  // Probably only have to #include this one
         ^
1 error generated.

I am able to work around this by applying the following patch for non-ilut builds:

      inreplace "include/IL/devil_cpp_wrapper.hpp",
        "<IL/ilut.h>", "\"ilu.h\""

If I just delete #include <IL/ilut.h>, instead of replacing it with #include "ilut.h", then I get this error instead:

In file included from test.cpp:1:
/usr/local/include/IL/devil_cpp_wrapper.hpp:10:13: error: unknown type name 'ILconst_string'
                                ilImage(ILconst_string);
                                        ^
/usr/local/include/IL/devil_cpp_wrapper.hpp:14:2: error: unknown type name 'ILboolean'
        ILboolean       Load(ILconst_string);
        ^
/usr/local/include/IL/devil_cpp_wrapper.hpp:14:17: error: unknown type name 'ILconst_string'
        ILboolean       Load(ILconst_string);
                             ^
...

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

psd with multiple layers

  • ilGetInteger(IL_NUM_LAYERS) returns zero for psd with multiple layers.
  • ilActiveLayer(n) returns only for n=0 a layer.

homebrew

Tried to install DevIL on OS X Yosemite using homebrew and discovered that with brew the DevIL home and homebrew formula still refer to sourceforge

Tom

bug in IL_NUM_IMAGES for animations

There seems to be some issues with IL_NUM_IMAGES:

cannot add devil nuget package to .net project

When i want to add the devil nuget package to my .net project i get an error, because of devil redist.

The redist package is required, but does not target any .net versions. Thus it cannot be installed.

Because the installation of devil redist fails, the installation of devil fails

Cmakelists error

Hi,

There seems to be an error in Cmakelists file:

CMake Error at src-IL/CMakeLists.txt:42 (ADD_LIBRARY):
Cannot find source file:

msvc/il.def

Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx

Cheers,
Alex

compilation Error :

Hi,
I was trying to cross- compile devIL for a intel x64bit linux hardware , but i get a compilation error while doing a make,i followed the steps in ReadMe.cmake file .does anybody came across these problems,kindly comment

/home/zjlkk8/libILU/DevIL-master/DevIL/src-IL/src/il_jpeg.cpp: In function 'boolean fill_input_buffer(j_decompress_ptr)':
/home/zjlkk8/libILU/DevIL-master/DevIL/src-IL/../include/IL/il.h:118:20: error: invalid conversion from 'int' to 'boolean' [-fpermissive]
#define IL_FALSE 0
^
/home/zjlkk8/libILU/DevIL-master/DevIL/src-IL/src/il_jpeg.cpp:248:10: note: in expansion of macro 'IL_FALSE'
return IL_FALSE;

JasPer uchar definition is gone

In response to jasper-software/jasper#72, JasPer no longer defines uchar but instead defines jas_uchar. Quoting @mdadams from there:

I hope that nobody was relying on the cruft that was in jas_config.h that actually should not have been there. If anyone was, their code will no longer compile.

Current DevIL won't compile against latest JasPer due to things like this cast.

Best DevIL version to use? Should ReSIL be used over DevIL?

I'm trying to figure out which version of DevIL is best to use. ReSIL? DevIL?
In particular I'd like to update homebrew as mentioned in #19

Options include:

I guess a modicum of minimal help would be appreciated! That would consist of merging the cmake changes release zip produced so I can update the homebrew script.

Perhaps resil has even more high quality changes, but I'd completely understand if you're not available for something larger like that, or even the smaller change mentioned above.

iluGammaCorrect

Hi,
I have looked at this code:

ILboolean ILAPIENTRY iluGammaCorrect(ILfloat Gamma)

As I understand it, there are two issues with it.

  1. With bpc (bytes per channel) > 1 the algorithm throws away any higher precision data and outputs just 256 different levels. It should properly compute the power instead of using the precomputed table. (Or precompute higher-precision table depending on the image resolution.)

  2. The algorithm applies to alpha channel too. Since Devil was designed to work well with OpenGL, I would assume that it would behave similar to sRGB textures, which do NOT alter the alpha channel.
    https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml
    Or is alpha channel stored separately? I am not that much familiar with Devil internals.

New build system

You mention on your page, that a new build system is used. Which one? How to switch?

libILUT.so: undefined reference to `gluBuild2DMipmaps'

Hi:
I compiled the libraries by adding the solution from issue #54, Now when I compiling an example I got the following error: libILUT.so: undefined reference to `gluBuild2DMipmaps'

What package I have missing? or what option I need to compile the library?

Thanks!

DXT mipmaps access

Hello sir.It is not clear from the documentation how to access individual mipmaps in mipmapped DXT image.

is it enough before each access to call iluActiveMipmap ?

I need to iterate all the mipmaps in order to upload them to GL texture.

Thanks!

Related to GLUT for Ubuntu installation

Hi
Trying to install on Ubuntu 18.04 with mesa-utils package installed, I get the following error

$ dpkg -l | grep mesa-utils*
ii  mesa-utils                                 8.4.0-1                                     amd64        Miscellaneous Mesa GL utilities
ii  mesa-utils-extra                           8.4.0-1                                     amd64        Miscellaneous Mesa utilies (opengles, egl)
$ cmake ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
DevIL, 64 bit compiler detected
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.34") 
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so  
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR) 
-- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR) 
-- Could not find libSquish
-- Could NOT find LCMS2 (missing: LCMS2_LIBRARY LCMS2_INCLUDE_DIR) 
 
64 bit compiler detected
 
64 bit compiler detected
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find GLUT (missing: GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.10/Modules/FindGLUT.cmake:116 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  src-ILUT/CMakeLists.txt:24 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/mahmood/op/DevIL/DevIL/build/CMakeFiles/CMakeOutput.log".

Which package is missing then?

Install on Centos

Hi, I am trying to install DevIL on Centos but no luck so far. Are you aware of any repo containing devil packages?

ilLoadGifL / iReadLump out-of-bounds writing

I've isolated a bug that occurs when loading certain GIFs, demonstrated with this minimalistic code:

#include <stdlib.h>
#include <stdio.h>

#ifdef _MSC_VER
#pragma comment (lib, "DevIL.lib")
#pragma comment (lib, "ILU.lib")
#pragma comment (lib, "ILUT.lib")
#endif

#include <IL/il.h>
#include <IL/ilu.h>

char *load_raw_file(const char *path, size_t *size)
{
	FILE *in_file;
	char *data;
	size_t fsize;
	
	in_file = fopen(path, "rb");

	if (in_file==NULL)
	{
		fprintf(stderr, "File '%s' not found.\n", path);
		return NULL;
	}

	fseek(in_file, 0, SEEK_END);
	fsize = ftell(in_file);
	rewind (in_file);

	data = calloc (fsize+1, sizeof(char));
	fread(data, 1, fsize, in_file);

	fclose(in_file);

	if (size)
		*size = fsize;

	return data;	
}

void load_image_libdevil(const char *in_path)
{
	ILubyte *raw_data;
	size_t size;
	ILboolean err;
	ILuint ImgId;

	raw_data = load_raw_file(in_path, &size);
	if (raw_data==NULL || size==0)
		return ;

	// Initialize DevIL.
	ilInit();
	ilOriginFunc(IL_ORIGIN_UPPER_LEFT);
	ilEnable(IL_ORIGIN_SET);
	ilGenImages(1, &ImgId);		// Generate the main image name to use.
	ilBindImage(ImgId);		// Bind this image name.

	if (!ilLoadL(IL_TYPE_UNKNOWN, raw_data, size))
	{
		fprintf(stderr, "Could not open image from the %d byte buffer in memory\n", size);
		return ;
	}
}

int main()
{
	load_image_libdevil("1477604070775.gif");
	
	printf("Done.\n");

	return 0;
}

This code loads the GIF's data into memory then lets ilLoadL do its work. Typically it works fine except with some GIFs like this one, the call stack is ilLoadL→ilLoadGifL→iLoadGifInternal→GetImages→iGetPalette→iReadLump, and in iReadLump() the problem occurs at the line *((ILubyte*)Buffer + i) = *((ILubyte*)ReadLump + ReadLumpPos + i);, the problem being that *((ILubyte*)Buffer + i) is out of bounds for some reason.

I'm using DevIL 1.8.0, and appverif.exe to catch the problem. Here's a ZIP containing the source, the problem causing GIF, the VS2017 project and the DevIL.dll (and its .pdb file).

DevIL_bug.zip

cmake_install.cmake (line 42-47)

==> Making package: devil 1.8.0-1 (Fri Feb  9 00:37:59 CET 2018)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found v1.8.0.tar.gz
==> Validating source files with md5sums...
    v1.8.0.tar.gz ... Passed
==> Extracting sources...
  -> Extracting v1.8.0.tar.gz with bsdtar
==> Starting prepare()...
==> Removing existing $pkgdir/ directory...
==> Starting build()...
 
64 bit compiler detected
-- Could not find libSquish
 
64 bit compiler detected
 
64 bit compiler detected
-- Configuring done
-- Generating done
-- Build files have been written to: /home/matthias/Projekte/KaOS/makepkg/devil/src
[ 71%] Built target IL
[ 88%] Built target ILU
[100%] Built target ILUT
==> Entering fakeroot environment...
==> Starting package()...
[ 71%] Built target IL
[ 88%] Built target ILU
[100%] Built target ILUT
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libIL.so
CMake Error at src-IL/cmake_install.cmake:47 (file):
  file INSTALL cannot copy file
  "/home/matthias/Projekte/KaOS/makepkg/devil/src/lib/x64/libIL.so" to
  "/usr/local/lib/libIL.so".
Call Stack (most recent call first):
  cmake_install.cmake:42 (include)


make: *** [Makefile:74: install] Error 1
==> ERROR: A failure occurred in package().
    Aborting...

screenshot_20180209_004243

Linux (KaOS)
cmake 3.10.2

Invalid write / SIGSEGV

Following sample file crashes libdevil. The bug was found using examples/simple_example/simple.c with the sample file as input. Sample gif input file is fuzzed with american fuzzy lop http://lcamtuf.coredump.cx/afl/.

sample file hexdump:

00000000  47 49 46 38 39 61 10 00  00 00 f7 ff 00 00 00 00  |GIF89a..........|
00000010  03 04 04 04 05 05 05 06  06 06 07 07 07 08 08 08  |................|
00000020  09 09 09 0a 0a 0a 0b 0b  0b 0c 0c 0c 0d 0d 0d 0e  |................|
00000030  0e 0e 0f 0f 0f 10 10 10  11 11 11 12 12 12 13 13  |................|
00000040  13 14 14 14 15 15 15 16  16 16 17 17 17 18 18 18  |................|
00000050  19 19 19 1a 1a 1a 1b 1b  1b 1c 1c 1c 1d 1d 1d 1e  |................|
00000060  1e 1e 1f 1f 1f 20 20 20  21 21 21 22 22 22 23 23  |.....   !!!"""##|
00000070  23 24 24 24 25 25 25 26  26 26 27 27 27 28 28 28  |#$$$%%%&&&'''(((|
00000080  29 29 29 2a 2a 2a 2b 2b  2b 2c 2c 2c 2d 2d 2d 2e  |)))***+++,,,---.|
00000090  2e 2e 2f 2f 2f 30 30 30  31 31 31 32 32 32 33 33  |..///00011122233|
000000a0  33 34 34 34 35 35 35 36  36 36 37 37 37 38 38 38  |3444555666777888|
000000b0  39 39 39 3a 3a 3a 3b 3b  3b 3c 3c 3c 3d 3d 3d 3e  |999:::;;;<<<===>|
000000c0  3e 3e 3f 3f 3f 40 40 40  41 41 41 42 42 42 43 43  |>>???@@@AAABBBCC|
000000d0  43 44 44 44 45 45 45 46  46 46 47 47 47 48 48 48  |CDDDEEEFFFGGGHHH|
000000e0  49 49 49 4a 4a 4a 4b 4b  4b 4c 4c 4c 4d 4d 4d 4e  |IIIJJJKKKLLLMMMN|
000000f0  4e 4e 4f 4f 4f 50 50 50  51 51 51 52 52 52 53 53  |NNOOOPPPQQQRRRSS|
00000100  53 54 54 54 55 55 55 56  56 56 57 57 57 58 58 58  |STTTUUUVVVWWWXXX|
00000110  59 59 59 5a 5a 5a 5b 5b  5b 5c 5c 5c 5d 5d 5d 5e  |YYYZZZ[[[\\\]]]^|
00000120  5e 5e 5f 5f 5f 60 60 60  61 61 61 62 62 62 63 63  |^^___```aaabbbcc|
00000130  63 64 64 64 65 65 65 66  66 66 67 67 67 68 68 68  |cdddeeefffggghhh|
00000140  69 69 69 6a 6a 6a 6b 6b  6b 6c 6c 6c 6d 6d 6d 6e  |iiijjjkkklllmmmn|
00000150  6e 6e 6f 6f 6f 70 70 70  71 71 71 72 72 72 73 73  |nnooopppqqqrrrss|
00000160  73 74 74 74 75 75 75 76  76 76 77 77 77 78 78 78  |stttuuuvvvwwwxxx|
00000170  79 79 79 7a 7a 7a 7b 7b  7b 7c 7c 7c 7d 7d 7d 7e  |yyyzzz{{{|||}}}~|
00000180  7e 7e 7f 7f 7f 80 80 80  81 81 81 82 82 82 83 83  |~~..............|
00000190  83 84 84 84 85 85 85 86  86 86 87 87 87 88 88 88  |................|
000001a0  89 89 89 8a 8a 8a 8b 8b  8b 8c 8c 8c 8d 8d 8d 8e  |................|
000001b0  8e 8e 8f 8f 8f 90 90 90  91 91 91 92 92 92 93 93  |................|
000001c0  93 94 94 94 95 95 95 96  96 96 97 97 97 98 98 98  |................|
000001d0  99 99 99 9a 9a 9a 9b 9b  9b 9c 9c 9c 9d 9d 9d 9e  |................|
000001e0  9e 9e 9f 9f 9f a0 a0 a0  a1 a1 a1 a2 a2 a2 a3 a3  |................|
000001f0  a3 a4 a4 a4 a5 a5 a5 a6  a6 a6 a7 a7 a7 a8 a8 a8  |................|
00000200  a9 a9 a9 aa aa aa ab ab  ab ac ac ac ad ad ad ae  |................|
00000210  ae ae af af af b0 b0 b0  b1 b1 b1 b2 b2 b2 b3 b3  |................|
00000220  b3 b4 b4 b4 b5 b5 b5 b6  b6 b6 b7 b7 b7 b8 b8 b8  |................|
00000230  b9 b9 b9 ba ba ba bb bb  bb bc bc bc bd bd bd be  |................|
00000240  be be bf bf bf c0 c0 c0  c1 c1 c1 c2 c2 c2 c3 c3  |................|
00000250  c3 c4 c4 c4 c5 c5 c5 c6  c6 c6 c7 c7 c7 c8 c8 c8  |................|
00000260  c9 c9 c9 ca ca ca cb cb  cb cc cc cc cd cd cd ce  |................|
00000270  ce ce cf cf cf d0 d0 d0  d1 d1 d1 d2 d2 d2 d3 d3  |................|
00000280  d3 d4 d4 d4 d5 d5 d5 d6  d6 d6 d7 d7 d7 d8 d8 d8  |................|
00000290  d9 d9 d9 da da da db db  db dc dc dc dd dd dd de  |................|
000002a0  de de df df df e0 e0 e0  e1 e1 e1 e2 e2 e2 e3 e3  |................|
000002b0  e3 e4 e4 e4 e5 e5 e5 e6  e6 e6 e7 e7 e7 e8 e8 e8  |................|
000002c0  e9 e9 e9 ea ea ea eb eb  eb ec ec ec ed ed ed ee  |................|
000002d0  ee ee ef ef ef f0 f0 f0  f1 f1 f1 f2 f2 f2 f3 f3  |................|
000002e0  f3 f4 f4 f4 f5 f5 f5 f6  f6 f6 f7 f7 f7 f8 f8 f8  |................|
000002f0  f9 f9 f9 fa fa fa fb fb  fb fc fc fc fd fd fd fe  |................|
00000300  fe fe ff ff ff 21 f9 04  00 00 00 00 00 2c 00 00  |.....!.......,..|
00000310  00 00 10 00 10 00 00 08  80 02 06 05 18 2c a8 10  |.............,..|
00000320  10 40 c4 7f fd 04 ea f3  f7 cf df 41 82 04 02 74  |[email protected]|
00000330  8c 28 20 40 44 92 02 2b  3e 84 68 70 e5 bf 8a 04  |.( @D..+>.hp....|
00000340  4d 3e f4 47 b1 20 00 8a  06 07 22 20 08 13 e3 bf  |M>.G. ...." ....|
00000350  7d 22 21 be 0c 10 60 20  00 01 fd 3a 4a f4 97 94  |}"!...` ...:J...|
00000360  9f 51 85 44 2f 7a 5c a9  af 80 4d a3 b7 b2 a2 01  |.Q.D/z\...M.....|
00000370  82 08 79 02 f8 5a d0 2a  cc b3 0b 05 40 3d 9a b3  |..y..Z.*....@=..|
00000380  62 51 b4 09 2b 2a 1c 58  60 e0 00 01 77 79 7e 95  |bQ..+*.X`...wy~.|
00000390  0b 73 6d c3 82 36 71 36  1c 1c 10 00              |.sm..6q6....|
0000039c

How to reproduce:

# clang -o simple examples/simple_example/simple.c -lIL -lILU -lILUT
# ./simple <sample-file>

gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff731ea35 in getc () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff731ea35 in getc () from /usr/lib/libc.so.6
#1  0x00007ffff789db28 in iDefaultGetc () from build/lib/x64/libIL.so
#2  0x00007ffff789df4e in iGetcFile() () from build/lib/x64/libIL.so
#3  0x00007ffff78a0cc8 in GetImages(ILpal*, GIFHEAD*) () from build/lib/x64/libIL.so
#4  0x00007ffff78a0604 in iLoadGifInternal() () from build/lib/x64/libIL.so
#5  0x00007ffff78a0416 in ilLoadGifF () from build/lib/x64/libIL.so
#6  0x00007ffff78a03bd in ilLoadGif () from build/lib/x64/libIL.so
#7  0x00007ffff78ab4fe in ilLoad () from build/lib/x64/libIL.so
#8  0x00007ffff78ac315 in ilLoadImage () from build/lib/x64/libIL.so
#9  0x00000000004010c9 in main (argc=2, argv=0x7fffffffe5c8) at examples/simple_example/simple.c:64

valgrind:

==25225== Memcheck, a memory error detector                                                  
==25225== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==25225== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==25225== Command: build/lib/x64/simple findings/crashes/id:000001,sig:11,src:000000,op:flip1,pos:8
==25225== 
==25225== Conditional jump or move depends on uninitialised value(s)
==25225==    at 0x509D649: GifGetData(ILimage*, unsigned char*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, GFXCONTROL*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509CC26: GetImages(ILpal*, GIFHEAD*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C603: iLoadGifInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C415: ilLoadGifF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C3BC: ilLoadGif (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50A74FD: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x4010C8: main (simple.c:64)
==25225==  Uninitialised value was created by a heap allocation
==25225==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25225==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509D2FC: GifGetData(ILimage*, unsigned char*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, GFXCONTROL*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509CC26: GetImages(ILpal*, GIFHEAD*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C603: iLoadGifInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C415: ilLoadGifF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C3BC: ilLoadGif (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50A74FD: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x4010C8: main (simple.c:64)
==25225== 
==25225== Invalid write of size 1
==25225==    at 0x509D84A: GifGetData(ILimage*, unsigned char*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, GFXCONTROL*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509CC26: GetImages(ILpal*, GIFHEAD*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C603: iLoadGifInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C415: ilLoadGifF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C3BC: ilLoadGif (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50A74FD: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x4010C8: main (simple.c:64)
==25225==  Address 0xa192610 is 0 bytes after a block of size 16 alloc'd
==25225==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25225==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x5091B77: ilInitImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x5091FE3: ilTexImage_ (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x5091E62: ilTexImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C598: iLoadGifInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C415: ilLoadGifF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C3BC: ilLoadGif (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50A74FD: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x4010C8: main (simple.c:64)
==25225== 
Width: 16  Height: 1  Depth: 1  Bpp: 8
==25225== Syscall param write(buf) points to uninitialised byte(s)
==25225==    at 0x569D3C0: __write_nocancel (in /usr/lib/libc-2.25.so)
==25225==    by 0x5632F96: _IO_file_write@@GLIBC_2.2.5 (in /usr/lib/libc-2.25.so)
==25225==    by 0x5632231: new_do_write (in /usr/lib/libc-2.25.so)
==25225==    by 0x5634078: _IO_do_write@@GLIBC_2.2.5 (in /usr/lib/libc-2.25.so)
==25225==    by 0x5633937: _IO_file_close_it@@GLIBC_2.2.5 (in /usr/lib/libc-2.25.so)
==25225==    by 0x5626DEE: fclose@@GLIBC_2.2.5 (in /usr/lib/libc-2.25.so)
==25225==    by 0x5099CC4: iDefaultCloseW(void*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50D1435: ilSaveTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50A9960: ilSaveImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x4011C0: main (simple.c:83)
==25225==  Address 0xa197790 is 800 bytes inside a block of size 4,096 alloc'd
==25225==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25225==    by 0x5626B6B: _IO_file_doallocate (in /usr/lib/libc-2.25.so)
==25225==    by 0x5635285: _IO_doallocbuf (in /usr/lib/libc-2.25.so)
==25225==    by 0x5634577: _IO_file_overflow@@GLIBC_2.2.5 (in /usr/lib/libc-2.25.so)
==25225==    by 0x5633635: _IO_file_xsputn@@GLIBC_2.2.5 (in /usr/lib/libc-2.25.so)
==25225==    by 0x56281CA: fwrite (in /usr/lib/libc-2.25.so)
==25225==    by 0x5099D2A: iDefaultWrite (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509A82C: iWriteFile(void const*, unsigned int, unsigned int) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50D15FB: iSaveTargaInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50D1485: ilSaveTargaF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50D1417: ilSaveTarga (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50A9960: ilSaveImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==  Uninitialised value was created by a heap allocation
==25225==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25225==    by 0x50752A4: DefaultAllocFunc(unsigned long) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x5075193: ialloc (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509D2FC: GifGetData(ILimage*, unsigned char*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, GFXCONTROL*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509CC26: GetImages(ILpal*, GIFHEAD*) (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C603: iLoadGifInternal() (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C415: ilLoadGifF (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x509C3BC: ilLoadGif (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50A74FD: ilLoad (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x50A8314: ilLoadImage (in /tmp/DevIL/build/lib/x64/libIL.so.1)
==25225==    by 0x4010C8: main (simple.c:64)
==25225== 
==25225== 
==25225== HEAP SUMMARY:
==25225==     in use at exit: 32 bytes in 1 blocks
==25225==   total heap usage: 113 allocs, 112 frees, 133,452 bytes allocated
==25225== 
==25225== LEAK SUMMARY:
==25225==    definitely lost: 0 bytes in 0 blocks
==25225==    indirectly lost: 0 bytes in 0 blocks
==25225==      possibly lost: 0 bytes in 0 blocks
==25225==    still reachable: 32 bytes in 1 blocks
==25225==         suppressed: 0 bytes in 0 blocks
==25225== Rerun with --leak-check=full to see details of leaked memory
==25225== 
==25225== For counts of detected and suppressed errors, rerun with: -v
==25225== ERROR SUMMARY: 82 errors from 3 contexts (suppressed: 0 from 0)

PNG load test

Hi,First I am happy of the fact that the lib's dev seems to be resurrected.Second,I was conducting some comparisons to other png loading libs on the market and so far DevIL beats them all .
I thought maybe this info will be useful to put on a wiki or intro page:

test: load RGBA png ,size 512x512

System:Windows7 64bit,16Gb RAM ,Intel I7 ,VS2012 ,64bit C++ project.

LodePNG - 36.6 ms
STB_IMAGE - 32ms
DevIL - 8.7ms

Also,it would be nice to have DevIL built as static lib.

Thanks!

Corrupted Targa header for RGBA

In experimenting a bit with .tga generation I have spotted a few bad bytes in the file that prevented it from being displayed in some software (most notably Maya).

Link errors with inline functions

(Not really a bug report yet - mainly a place to dump my thoughts!)

I hadn't realised just how fragmented support was for inline functions across different compilers!
I'm doing some CMake work and having a lot of trouble with inline functions.

Usually problems manifest as symbols being multiply defined (eg function bodies in header files being instantiated every time they're included) or symbols missing (eg inlining working fine, but the library still referencing a function which was never generated as a stand-alone thing).

As I see it, DevIL needs to support three distinct sets of inline rules:

  1. C99 (eg clang on OSX, GCC with -std=c99)
  2. GNU C (legacy GCC)
  3. C++ (most specifically Visual C/C++ which compiles C as C++?)

(Details of the C99 and GNU rules here:
http://www.greenend.org.uk/rjk/tech/inline.html)

That web page has some strategies for dealing with this issue, and DevIL definitely applies it in various places. But it'd be nice to be a bit more explicit on how inlines are handled.

Anyway, I'll be tinkering with various approaches, and will add notes here as I go.

Can't disable JPG support

#52 (comment)

@abma great, I will test when I get home :) A side question, do you know how I disable ex. jpeg support? I tried cmake -DIL_NO_JPG=1 but it still links with libjpeg. I need to include DevIL at a static library, and so I want to reduce the amount of library I need to compile static.

#52 (comment)

It still seems to link:

[kristian@arch-hp-laptop build]$ cmake -DIL_NO_JPG=1 ..
-- The C compiler identification is GNU 6.3.1
-- The CXX compiler identification is GNU 6.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
DevIL, 64 bit compiler detected
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")
-- Found PNG: /usr/lib64/libpng.so (found version "1.6.28")
-- Found JPEG: /usr/lib64/libjpeg.so
-- Found TIFF: /usr/lib64/libtiff.so (found version "4.0.7")
-- Found Jasper: /usr/lib64/libjasper.so (found version "2.0.10")
-- Could not find libSquish
-- Found LCMS2: /usr/lib64/liblcms2.so

64 bit compiler detected

64 bit compiler detected
-- Could NOT find cppunit (missing: CPPUNIT_LIBRARY CPPUNIT_INCLUDE_DIR)
-- UnitTest disabled, cppunit wasn't found!
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kristian/Hentninger/DevIL/DevIL/build
-- Build files have been written to: /home/kristian/Hentninger/DevIL/DevIL/build
[kristian@arch-hp-laptop build]$ make
Scanning dependencies of target IL
[ 0%] Building CXX object src-IL/CMakeFiles/IL.dir/src/altivec_common.cpp.o
[....]
[100%] Linking CXX shared library ../lib/x64/libILUT.so
[100%] Built target ILUT
[kristian@arch-hp-laptop build]$ ldd lib/x64/*.so | grep libjpeg
libjpeg.so.8 => /usr/lib/libjpeg.so.8 (0x00007fd6e0956000)
libjpeg.so.8 => /usr/lib/libjpeg.so.8 (0x00007f456d27f000)
libjpeg.so.8 => /usr/lib/libjpeg.so.8 (0x00007f3453b93000)

so I'm wondering if something is broken in the cmake script.

IL_PNG_ALPHA_INDEX colour-key doesn't work

IL_PNG_ALPHA_INDEX is supposed to let the user specify a single colour index which should be treated as transparent, but the implementation is wrong.
It's not too hard to fix, but I think the "proper" solution is to just support palettes with alpha values, as per commit c0e964d.

I propose IL_PNG_ALPHA_INDEX should be removed, or at least deprecated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.