Commit Graph

18 Commits

Author SHA1 Message Date
Stefan Weil 4d2b6a671a Update implementation of opj_calloc (#705) 2016-05-10 22:08:49 +02:00
Stefan Weil 9cad6bc1f6 Fix fatal crash on 64 bit Linux
By default, OpenJPEG uses the function memalign to allocate aligned
memory on Linux systems. That function needs malloc.h which was
missing. This results in a compiler warning:

openjpeg/src/lib/openjp2/opj_malloc.c:63:3: warning:
 implicit declaration of function ‘memalign’
 [-Wimplicit-function-declaration]

On hosts where sizeof(int) < sizeof(void *) the return value of memalign
will be truncated which results in an invalid pointer.

That caused "make test" to produce lots of segmentation faults when
running on a 64 bit Linux host.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 21:40:09 +01:00
Stefan Weil 79b1c4cc85 Fix whitespace issues in opj_malloc.c
Some lines ended with spaces. Remove them.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 21:40:01 +01:00
Stefan Weil a834ab305f Fix grammar in comment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-12-31 10:13:26 +01:00
mayeut 38ffbbe42e Fin compiler warnings 2015-11-01 17:08:47 +01:00
Stephan Mühlstrasser b7a162348d Avoid pointer arithmetic with (void *) pointers. 2015-10-21 09:01:31 +02:00
mayeut d48be27f5a Generic aligned malloc implementation update.
Update #642
2015-10-21 00:09:04 +02:00
Stephan Mühlstrasser eaf55b677c Generic aligned malloc implementation.
Used for platforms where none of posix_memalign(), memalign() and
_aligned_malloc() is available.
2015-10-20 21:34:54 +02:00
mayeut e1122a8f50 Cleanup includes 2015-10-18 02:52:33 +02:00
mayeut f9d47e28b9 Fix _aligned_malloc usage 2015-10-18 02:23:01 +02:00
mayeut 8034ffde8b Fix inconsistent behavior of malloc(0)
Update #635
Update #625
2015-10-17 02:55:09 +02:00
mayeut b3a15954f6 Add missing checks. Fix crash on failed allocation. 2015-10-17 02:16:17 +02:00
mayeut 83249c318f Fixed crash on encoding
Update #624
Update #625
2015-10-17 01:30:23 +02:00
Mathieu Malaterre dd81b5892d minor tweaks to the code 2015-10-12 21:24:10 +02:00
Mathieu Malaterre ab8929262a Fix an issue with parenthesis 2015-10-10 21:03:44 +02:00
Mathieu Malaterre d753441028 implement a portable aligned realloc 2015-10-10 17:51:29 +02:00
Mathieu Malaterre 2d410fc74b do not use aligned_alloc since it requires c11 2015-10-10 14:54:21 +02:00
Mathieu Malaterre 0dc4914b4e cleanup header file and move to implementation 2015-10-09 22:04:04 +02:00