strukturag / libheif Goto Github PK
View Code? Open in Web Editor NEWlibheif is an HEIF and AVIF file format decoder and encoder.
License: Other
libheif is an HEIF and AVIF file format decoder and encoder.
License: Other
Sorry to bother you 。Can I use VS to compile libheif?
Revision 943361a breaks automatic color profile determination:
./examples/heif-enc ~/Desktop/rndimg.png
Assertion failed: (m_color_profile), function write, file box.cc, line 1693.
Abort trap: 6
Conversion works fine without the patch.
Apologies, asking for a release/asking for information on when the next release is likely to be always feels like a big of a nag.
Just wondering if it'd be possible to get an estimate on that because the current 1.1.0 release doesn't compile on macOS. Has already been fixed in master with 001a93c2, 7ac92eb0 & a237e50a. As far as I'm aware those are the only clang/macOS issues present currently; the current master branch here builds fine.
The @ImageMagick project is using https://github.com/google/oss-fuzz to find bugs in our own library and in libraries that we use. The fuzzer found an issue and we think this is an issue that should be resolved in the library that we use. This issue is posted under the url https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9231 that is not publicly visible yet but added as a link for future reference. Below are the details of the issue that can be reproduced using the following technique: https://github.com/google/oss-fuzz/blob/master/docs/reproducing.md
Stacktrace:
WARNING: MemorySanitizer: use-of-uninitialized-value
--
| #0 0x15a256e in heif::HeifContext::decode_overlay_image(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>&, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) const libheif/src/heif_context.cc:1186:28
| #1 0x159a257 in heif::HeifContext::decode_image(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>&, heif_decoding_options const*) const libheif/src/heif_context.cc:843:13
| #2 0x15a2b1b in heif::HeifContext::decode_and_paste_tile_image(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const libheif/src/heif_context.cc:1070:15
| #3 0x15b9f4a in __invoke<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int, void> /usr/local/include/c++/v1/type_traits:4421:1
| #4 0x15b9f4a in heif::Error std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int>::__execute<1ul, 2ul, 3ul, 4ul, 5ul>(std::__1::__tuple_indices<1ul, 2ul, 3ul, 4ul, 5ul>) /usr/local/include/c++/v1/future:2330
| #5 0x15b9c08 in std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int>::operator()() /usr/local/include/c++/v1/future:2323:16
| #6 0x15b8e4b in std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >::__execute() /usr/local/include/c++/v1/future:985:25
| #7 0x15ba2b7 in __invoke<void (std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >::*)(), std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> > *, void> /usr/local/include/c++/v1/type_traits:4421:1
| #8 0x15ba2b7 in __thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >::*)(), std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> > *, 2> /usr/local/include/c++/v1/thread:342
| #9 0x15ba2b7 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >::*)(), std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >*> >(void*) /usr/local/include/c++/v1/thread:352
Links:
Line 1186 in b56e683
Commit: 01fe0a8
Testcase file: clusterfuzz-testcase-minimized-encoder_heic_fuzzer-5171925214035968.zip
Is there any builds/download available for libheif.js?
The @ImageMagick project is using https://github.com/google/oss-fuzz to find bugs in our own library and in libraries that we use. The fuzzer found an issue and we think this is an issue that should be resolved in the library that we use. This issue is posted under the url https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8062 that is not publicly visible yet but added as a link for future reference. Below are the details of the issue that can be reproduced using the following technique: https://github.com/google/oss-fuzz/blob/master/docs/reproducing.md
Stacktrace:
/usr/local/bin/../include/c++/v1/sstream:599:12: runtime error: signed integer overflow: 16 + 9223372036854775792 cannot be represented in type 'long long'
#0 0x437982 in std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::seekoff(long long, std::__1::ios_base::seekdir, unsigned int) /usr/local/include/c++/v1/sstream:599:12
#1 0xf9608c in std::__1::basic_istream<char, std::__1::char_traits<char> >::seekg(long long, std::__1::ios_base::seekdir)
#2 0x9329d4 in heif::Box::parse(heif::BitstreamRange&) libheif/src/box.cc:291:28
#3 0x934025 in heif::Box::read(heif::BitstreamRange&, std::__1::shared_ptr<heif::Box>*) libheif/src/box.cc:434:20
#4 0x96d96b in heif::HeifFile::parse_heif_file(heif::BitstreamRange&) libheif/src/heif_file.cc:165:19
#5 0x971c78 in heif::HeifFile::read_from_memory(void const*, unsigned long) libheif/src/heif_file.cc:81:17
#6 0x916524 in heif::HeifContext::read_from_memory(void const*, unsigned long) libheif/src/heif_context.cc:361:28
#7 0x9029b8 in heif_context_read_from_memory libheif/src/heif.cc:107:29
#8 0x7add39 in ReadHEICImage imagemagick/coders/heic.c:195:9
#9 0x53fc60 in ReadImage imagemagick/MagickCore/constitute.c:500:13
Links:
Line 291 in b56e683
Commit: b56e683
Testcase file: clusterfuzz-testcase-minimized-ping_heic_fuzzer-5816072648261632.zip
I have install X265 and turn on HAVE_X265 ,but i can't find heif_encoder_x265.h . should I rename x265.h to heif_encoder_x265.h.
Hello,
I am using this libheif for some developments. My goal is to use libheif as a muxer. Now I can get single HEVC I-Frame and want to use this libheif to mux(convert) to heic format.
From readme, it tells the "heif_context_write_to_file()" can output the heic file with encoded heic_image structure. Can I just memcpy the prepared hevc image to heic_image plane and invoke heif_context_write_to_file() to generate the heic file?.
Any comments or documents are welcome, thank you.
By the way, as a followup of PR #25, there is a last problem whose solution, I haven't found yet.
A simple make (crossbuild with mingw-w64) fails during linking with:
make all-recursive
make[1]: Entering directory '/opt/user-cache/jehan/dev/crossbuild/w64/libheif'
Making all in src
make[2]: Entering directory '/opt/user-cache/jehan/dev/crossbuild/w64/libheif/src'
/bin/sh ../libtool --tag=CXX --mode=link x86_64-w64-mingw32-g++ -I/home/jehan/.local/share/crossroad/roads/w64/libheif/include -DLIBHEIF_EXPORTS -g -O2 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -version-info 2:0:1 -o libheif.la -rpath /home/jehan/.local/share/crossroad/roads/w64/libheif/lib libheif_la-bitstream.lo libheif_la-box.lo libheif_la-error.lo libheif_la-heif_file.lo libheif_la-heif_image.lo libheif_la-heif.lo libheif_la-heif_context.lo libheif_la-heif_hevc.lo libheif_la-heif_plugin_registry.lo libheif_la-heif_plugin.lo libheif_la-heif_decoder_libde265.lo -lde265 -L/home/jehan/.local/share/crossroad/roads/w64/libheif/lib -lpthread
libtool: error: can't build x86_64-w64-mingw32 shared library unless -no-undefined is specified
make[2]: *** [Makefile:647: libheif.la] Error 1
make[2]: Leaving directory '/opt/user-cache/jehan/dev/crossbuild/w64/libheif/src'
make[1]: *** [Makefile:502: all-recursive] Error 1
make[1]: Leaving directory '/opt/user-cache/jehan/dev/crossbuild/w64/libheif'
make: *** [Makefile:411: all] Error 2
A workaround exists, which is to build with make LDFLAGS=-no-undefined
instead (as proposed by the error message). Then it goes to the end.
I'm not sure of the cause yet. Maybe some library is missing on the linking flags.
We should also check the encoding in the fuzzer. Fuzzed parameters could be the image size, color format, encoder parameters and algorithmically generated image content.
The @ImageMagick project is using https://github.com/google/oss-fuzz to find bugs in our own library and in libraries that we use. The fuzzer found an issue and we think this is an issue that should be resolved in the library that we use. This issue is posted under the url https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8922 that is not publicly visible yet but added as a link for future reference. Below are the details of the issue that can be reproduced using the following technique: https://github.com/google/oss-fuzz/blob/master/docs/reproducing.md
Stacktrace:
==1==ERROR: AddressSanitizer: ABRT on unknown address 0x000000000001 (pc 0x7f5904896428 bp 0x0000018f7ca0 sp 0x7ffc65bccdd8 T0)
--
| SCARINESS: 10 (signal)
| #0 0x7f5904896427 in gsignal /build/glibc-Cl5G7W/glibc-2.23/sysdeps/unix/sysv/linux/raise.c:54
| #1 0x7f5904898029 in abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:89
| #2 0x7f590488ebd6 in __assert_fail_base /build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:92
| #3 0x7f590488ec81 in __assert_fail /build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:101
| #4 0xdc0e27 in heif::BitstreamRange::skip_without_advancing_file_pos(long) libheif/libheif/bitstream.cc:303:3
| #5 0xdc323c in heif::BitstreamRange::skip_to_end_of_box() libheif/libheif/bitstream.h:171:27
| #6 0xdc856b in heif::Box::read(heif::BitstreamRange&, std::__1::shared_ptr<heif::Box>*) libheif/libheif/box.cc:481:12
| #7 0xdc9efd in heif::Box::read_children(heif::BitstreamRange&, int) libheif/libheif/box.cc:540:19
| #8 0xdd67bd in heif::Box_iprp::parse(heif::BitstreamRange&) libheif/libheif/box.cc:1476:10
| #9 0xdc8454 in heif::Box::read(heif::BitstreamRange&, std::__1::shared_ptr<heif::Box>*) libheif/libheif/box.cc:476:20
| #10 0xdc9efd in heif::Box::read_children(heif::BitstreamRange&, int) libheif/libheif/box.cc:540:19
| #11 0xdd626c in heif::Box_iinf::parse(heif::BitstreamRange&) libheif/libheif/box.cc:1457:10
| #12 0xdc8454 in heif::Box::read(heif::BitstreamRange&, std::__1::shared_ptr<heif::Box>*) libheif/libheif/box.cc:476:20
| #13 0xdc9efd in heif::Box::read_children(heif::BitstreamRange&, int) libheif/libheif/box.cc:540:19
| #14 0xdcc183 in heif::Box_meta::parse(heif::BitstreamRange&) libheif/libheif/box.cc:714:10
| #15 0xdc8454 in heif::Box::read(heif::BitstreamRange&, std::__1::shared_ptr<heif::Box>*) libheif/libheif/box.cc:476:20
| #16 0xdfd67c in heif::HeifFile::parse_heif_file(heif::BitstreamRange&) libheif/libheif/heif_file.cc:166:19
| #17 0xdfcbf8 in heif::HeifFile::read(std::__1::shared_ptr<heif::StreamReader>) libheif/libheif/heif_file.cc:82:17
| #18 0xdfcf68 in heif::HeifFile::read_from_memory(void const*, unsigned long, bool) libheif/libheif/heif_file.cc:71:10
| #19 0xd9e356 in heif::HeifContext::read_from_memory(void const*, unsigned long, bool) libheif/libheif/heif_context.cc:356:28
| #20 0xd85d0d in heif_context_read_from_memory libheif/libheif/heif.cc:107:29
Links:
Line 303 in e20e012
Commit: 2706077
Testcase file: clusterfuzz-testcase-minimized-encoder_heic_fuzzer-6193003164073984.zip
Hello. I'm a iOS developer and recently I'm build a iOS-library which integrate libheif to a third-party lib SDWebImageHEIFCoder. Which support HEIF/HEIC decoding in old version iOS/macOS firmware. (Since iOS 11 & macOS 10.13 support HEIC natively)
But since I'm not an expert in image processing field, here are some questions I faced during the development. Some questions may be silly and I hope this will not bother someone :)
It seems some part of Readme is out-of-date.
heif_context_new_heic
this API is not available now. Maybe we can update the demo code about encoding ?frame-parallel
branch described in the compile part seems out-of-date. I try this branch of libde265 but this can't compile with the master
branch of libheif or latest v1.1.0 tag. So I then use the latest v1.0.3 tag of libde265 with v1.1.0 libheif tag to compile to iOS/macOS platform.I find that your're also the maintainer of libde265, So I put the question here.
To compile to iOS platform, I'm using Cmake with ios-cmake. For macOS, just using the official Cmake. All of following problem is about Cmake compile issue. (Not using autoconf)
master
branch or latest tag can not compile with the build-in config. It seems this API memalign
is not availble on macOS & iOS platform.I solve this by passing -DHAVE_POSIX_MEMALIGN
flag to Cmake to use posix_memalign
instead. However, since Cmake support feature detect, maybe this flag can be automatically config instead of manual set?
master
branch or latest tag can not compile with the build-in config. It seems the SSE4.1 detect cause some issue. See the log here:[ 34%] Building CXX object libde265/x86/CMakeFiles/x86_sse.dir/sse-motion.cc.o
/Users/lizhuoli/Documents/GitHub/libde265/libde265/x86/sse-motion.cc:746:29: error:
always_inline function '_mm_packus_epi32' requires target feature
'sse4.1', but would be inlined into function
'ff_hevc_weighted_pred_avg_8_sse4' that is compiled without support for
'sse4.1'
r0 = _mm_packus_epi32(r0, r2);
^
/Users/lizhuoli/Documents/GitHub/libde265/libde265/x86/sse-motion.cc:747:29: error:
always_inline function '_mm_packus_epi32' requires target feature
'sse4.1', but would be inlined into function
'ff_hevc_weighted_pred_avg_8_sse4' that is compiled without support for
'sse4.1'
r1 = _mm_packus_epi32(r1, r3);
I solve this by passing -DDISABLE_SSE
flag to Cmake to disable it. However, since ARM64 support SSE4.1, I guess this is not a good solution.
After I compile the binary for iOS & macOS platform and start using libheif. Though I can successfully run the demo and see the HEIF image decoding works. But there are some question I want to know.
Does libheif support progressive/Incremental image decoding ? Because my lib is a plugin to an image loading system, which support rendering partial image during large image download.
libheif's this encoding API heif_context_write
seems a little wired. I think this may be some misunderstanding from me but libheif library (See the code comments below). I use this API to write the encoded heif data to a memory representation but not file.
static struct heif_error WriteImageData(struct heif_context* ctx,
const void* data, size_t size, void* userdata) {
__autoreleasing NSData **imageData = (__autoreleasing NSData **)userdata;
NSCParameterAssert(imageData);
heif_error error;
if (!data) {
// Can this rgba data be NULL ?
// And how can I get the error information about this because there are no public API or input arg to grab the error information
error.code = heif_error_Encoder_plugin_error;
return error;
}
*imageData = [NSData dataWithBytes:data length:size];
error.code = heif_error_Ok;
return error;
}
// test code
void test() {
NSData *data;
heif_writer *writer;
writer->writer_api_version = 1;
writer->write = WriteImageData; // This is a function pointer
error = heif_context_write(ctx, writer, &data);
}
The @ImageMagick project is using https://github.com/google/oss-fuzz to find bugs in our own library and in libraries that we use. The fuzzer found an issue and we think this is an issue that should be resolved in the library that we use. This issue is posted under the url https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9283 that is not publicly visible yet but added as a link for future reference. Below are the details of the issue that can be reproduced using the following technique: https://github.com/google/oss-fuzz/blob/master/docs/reproducing.md
Stacktrace:
SCARINESS: 10 (null-deref)
--
| #0 0x7fb55a54dba5 in memcpy-avx-unaligned.S:180 /build/glibc-Cl5G7W/glibc-2.23/sysdeps/x86_64/multiarch/memcpy-avx-unaligned.S:180
| #1 0x4eba2a in __asan_memcpy _asan_rtl_
| #2 0xdaadca in heif::HeifContext::decode_and_paste_tile_image(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const libheif/libheif/heif_context.cc:1148:7
| #3 0xdbe62a in __invoke<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int, void> /usr/local/include/c++/v1/type_traits:4286:1
| #4 0xdbe62a in heif::Error std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int>::__execute<1ul, 2ul, 3ul, 4ul, 5ul>(std::__1::__tuple_indices<1ul, 2ul, 3ul, 4ul, 5ul>) /usr/local/include/c++/v1/future:2330
| #5 0xdbe3a8 in std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int>::operator()() /usr/local/include/c++/v1/future:2323:16
| #6 0xdbdb8a in std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >::__execute() /usr/local/include/c++/v1/future:985:25
| #7 0xdbe884 in __invoke<void (std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >::*)(), std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> > *, void> /usr/local/include/c++/v1/type_traits:4286:1
| #8 0xdbe884 in __thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >::*)(), std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> > *, 2> /usr/local/include/c++/v1/thread:342
| #9 0xdbe884 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >::*)(), std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >*> >(void*) /usr/local/include/c++/v1/thread:352
| #10 0x7fb55adf36b9 in start_thread
| #11 0x7fb55a50741c in clone /build/glibc-Cl5G7W/glibc-2.23/sysdeps/unix/sysv/linux/x86_64/clone.S:109
Links:
libheif/libheif/heif_context.cc
Line 1148 in 01fe0a8
Commit: 01fe0a8
Testcase file: clusterfuzz-testcase-minimized-encoder_heic_fuzzer-4878614100180992.zip
We are using libheif in the @ImageMagick project and I was trying to print the message from the heif_error
struct to give our users a better error message. But it turns out that we cannot use this in the C api because the error class is freed and then error.message
points to an invalid memory block.
struct heif_error heif_decode_image(const struct heif_image_handle* in_handle,
struct heif_image** out_img,
heif_colorspace colorspace,
heif_chroma chroma,
const struct heif_decoding_options* options)
{
std::shared_ptr<HeifPixelImage> img;
Error err = in_handle->image->decode_image(img,
colorspace,
chroma,
options);
if (err.error_code != heif_error_Ok) {
// After the return `err` gets freed and message points to an invalid block of memory.
return err.error_struct(in_handle->image.get());
}
*out_img = new heif_image();
(*out_img)->image = std::move(img);
return Error::Ok.error_struct(in_handle->image.get());
}
This can be resolved by making a copy of the string before this is copied to the error message but that means we would need to free the error message after each call. There is a comment that the error message will never be null. But I personally don't care about the error message when the message is Success
and then we would need to free it every time. I don't know what the best solution is for this issue so I will leave the solution up to you.
With gcc 7.3 compiling libheif1.3.2 fails with:
make all-recursive
make[1]: Entering directory '/src/gnome/gimp/libheif-1.3.2'
Making all in libheif
make[2]: Entering directory '/src/gnome/gimp/libheif-1.3.2/libheif'
CXX encoder_fuzzer.o
encoder_fuzzer.cc: In function ‘heif_error writer_write(heif_context*, const void*, size_t, void*)’:
encoder_fuzzer.cc:112:60: error: unused parameter ‘ctx’ [-Werror=unused-parameter]
static struct heif_error writer_write(struct heif_context* ctx, const void* data, size_t size, void* userdata) {
^~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:779: encoder_fuzzer.o] Error 1
CXX file_fuzzer.o
file_fuzzer.cc: In function ‘void TestDecodeImage(heif_context*, const heif_image_handle*)’:
file_fuzzer.cc:29:50: error: unused parameter ‘ctx’ [-Werror=unused-parameter]
static void TestDecodeImage(struct heif_context* ctx,
^~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:779: file_fuzzer.o] Error 1
CXX libheif_la-heif.lo
heif.cc: In function ‘int heif_image_handle_get_depth_image_representation_info(const heif_image_handle*, heif_item_id, const heif_depth_representation_info**)’:
heif.cc:358:72: error: unused parameter ‘depth_image_id’ [-Werror=unused-parameter]
heif_item_id depth_image_id,
^~~~~~~~~~~~~~
heif.cc: In function ‘heif_error heif_image_scale_image(const heif_image*, heif_image**, int, int, const heif_scaling_options*)’:
heif.cc:574:77: error: unused parameter ‘options’ [-Werror=unused-parameter]
const struct heif_scaling_options* options)
^~~~~~~
heif.cc: In function ‘int heif_context_get_encoder_descriptors(heif_context*, heif_compression_format, const char*, const heif_encoder_descriptor**, int)’:
heif.cc:799:63: error: unused parameter ‘ctx’ [-Werror=unused-parameter]
int heif_context_get_encoder_descriptors(struct heif_context* ctx,
^~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:838: libheif_la-heif.lo] Error 1
CXX libheif_la-heif_context.lo
heif_context.cc: In constructor ‘heif_encoder::heif_encoder(std::shared_ptr<heif::HeifContext>, const heif_encoder_plugin*)’:
heif_context.cc:51:63: error: unused parameter ‘_context’ [-Werror=unused-parameter]
heif_encoder::heif_encoder(std::shared_ptr<heif::HeifContext> _context,
^~~~~~~~
In file included from heif_hevc.h:24:0,
from heif_context.cc:43:
heif_context.cc: In member function ‘void ImageOverlay::get_offset(size_t, int32_t*, int32_t*) const’:
heif_context.cc:312:21: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
assert(image_index>=0 && image_index<m_offsets.size());
~~~~~~~~~~~^~~
heif_context.cc: In member function ‘heif::Error heif::HeifContext::encode_image(std::shared_ptr<heif::HeifPixelImage>, heif_encoder*, const heif_encoding_options*, heif_image_input_class, std::shared_ptr<heif::HeifContext::Image>&)’:
heif_context.cc:1402:61: error: unused parameter ‘input_class’ [-Werror=unused-parameter]
enum heif_image_input_class input_class,
^~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:845: libheif_la-heif_context.lo] Error 1
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/src/gnome/gimp/libheif-1.3.2/libheif'
Making all in examples
make[2]: Entering directory '/src/gnome/gimp/libheif-1.3.2/examples'
CXX heif_convert-encoder.o
In file included from encoder.cc:30:0:
encoder.h: In member function ‘virtual void Encoder::UpdateDecodingOptions(const heif_image_handle*, heif_decoding_options*) const’:
encoder.h:35:70: error: unused parameter ‘handle’ [-Werror=unused-parameter]
virtual void UpdateDecodingOptions(const struct heif_image_handle* handle,
^~~~~~
encoder.h:36:37: error: unused parameter ‘options’ [-Werror=unused-parameter]
struct heif_decoding_options *options) const {
^~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:644: heif_convert-encoder.o] Error 1
CXX heif_convert-heif_convert.o
In file included from heif_convert.cc:36:0:
encoder.h: In member function ‘virtual void Encoder::UpdateDecodingOptions(const heif_image_handle*, heif_decoding_options*) const’:
encoder.h:35:70: error: unused parameter ‘handle’ [-Werror=unused-parameter]
virtual void UpdateDecodingOptions(const struct heif_image_handle* handle,
^~~~~~
encoder.h:36:37: error: unused parameter ‘options’ [-Werror=unused-parameter]
struct heif_decoding_options *options) const {
^~~~~~~
In file included from heif_convert.cc:38:0:
encoder_jpeg.h: In member function ‘virtual heif_colorspace JpegEncoder::colorspace(bool) const’:
encoder_jpeg.h:37:35: error: unused parameter ‘has_alpha’ [-Werror=unused-parameter]
heif_colorspace colorspace(bool has_alpha) const override {
^~~~~~~~~
encoder_jpeg.h: In member function ‘virtual heif_chroma JpegEncoder::chroma(bool) const’:
encoder_jpeg.h:41:27: error: unused parameter ‘has_alpha’ [-Werror=unused-parameter]
heif_chroma chroma(bool has_alpha) const override {
^~~~~~~~~
In file included from heif_convert.cc:41:0:
encoder_png.h: In member function ‘virtual heif_colorspace PngEncoder::colorspace(bool) const’:
encoder_png.h:31:35: error: unused parameter ‘has_alpha’ [-Werror=unused-parameter]
heif_colorspace colorspace(bool has_alpha) const override {
^~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:658: heif_convert-heif_convert.o] Error 1
CXX heif_convert-encoder_jpeg.o
In file included from encoder_jpeg.h:31:0,
from encoder_jpeg.cc:26:
encoder.h: In member function ‘virtual void Encoder::UpdateDecodingOptions(const heif_image_handle*, heif_decoding_options*) const’:
encoder.h:35:70: error: unused parameter ‘handle’ [-Werror=unused-parameter]
virtual void UpdateDecodingOptions(const struct heif_image_handle* handle,
^~~~~~
encoder.h:36:37: error: unused parameter ‘options’ [-Werror=unused-parameter]
struct heif_decoding_options *options) const {
^~~~~~~
In file included from encoder_jpeg.cc:26:0:
encoder_jpeg.h: In member function ‘virtual heif_colorspace JpegEncoder::colorspace(bool) const’:
encoder_jpeg.h:37:35: error: unused parameter ‘has_alpha’ [-Werror=unused-parameter]
heif_colorspace colorspace(bool has_alpha) const override {
^~~~~~~~~
encoder_jpeg.h: In member function ‘virtual heif_chroma JpegEncoder::chroma(bool) const’:
encoder_jpeg.h:41:27: error: unused parameter ‘has_alpha’ [-Werror=unused-parameter]
heif_chroma chroma(bool has_alpha) const override {
^~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:672: heif_convert-encoder_jpeg.o] Error 1
CXX heif_convert-encoder_png.o
In file included from encoder_png.h:25:0,
from encoder_png.cc:26:
encoder.h: In member function ‘virtual void Encoder::UpdateDecodingOptions(const heif_image_handle*, heif_decoding_options*) const’:
encoder.h:35:70: error: unused parameter ‘handle’ [-Werror=unused-parameter]
virtual void UpdateDecodingOptions(const struct heif_image_handle* handle,
^~~~~~
encoder.h:36:37: error: unused parameter ‘options’ [-Werror=unused-parameter]
struct heif_decoding_options *options) const {
^~~~~~~
In file included from encoder_png.cc:26:0:
encoder_png.h: In member function ‘virtual heif_colorspace PngEncoder::colorspace(bool) const’:
encoder_png.h:31:35: error: unused parameter ‘has_alpha’ [-Werror=unused-parameter]
heif_colorspace colorspace(bool has_alpha) const override {
^~~~~~~~~
encoder_png.cc: In member function ‘virtual bool PngEncoder::Encode(const heif_image_handle*, const heif_image*, const string&)’:
encoder_png.cc:40:57: error: unused parameter ‘handle’ [-Werror=unused-parameter]
bool PngEncoder::Encode(const struct heif_image_handle* handle,
^~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:686: heif_convert-encoder_png.o] Error 1
make[2]: *** No rule to make target '../libheif/libheif.la', needed by 'heif-convert'.
CXX heif_enc-heif_enc.o
heif_enc.cc: In function ‘void show_help(const char*)’:
heif_enc.cc:66:28: error: unused parameter ‘argv0’ [-Werror=unused-parameter]
void show_help(const char* argv0)
^~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:700: heif_enc-heif_enc.o] Error 1
CXX heif_info-heif_info.o
heif_info.cc: In function ‘void show_help(const char*)’:
heif_info.cc:64:28: error: unused parameter ‘argv0’ [-Werror=unused-parameter]
void show_help(const char* argv0)
^~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:714: heif_info-heif_info.o] Error 1
CXX heif_thumbnailer-encoder.o
In file included from encoder.cc:30:0:
encoder.h: In member function ‘virtual void Encoder::UpdateDecodingOptions(const heif_image_handle*, heif_decoding_options*) const’:
encoder.h:35:70: error: unused parameter ‘handle’ [-Werror=unused-parameter]
virtual void UpdateDecodingOptions(const struct heif_image_handle* handle,
^~~~~~
encoder.h:36:37: error: unused parameter ‘options’ [-Werror=unused-parameter]
struct heif_decoding_options *options) const {
^~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:742: heif_thumbnailer-encoder.o] Error 1
CXX heif_thumbnailer-heif_thumbnailer.o
In file included from heif_thumbnailer.cc:36:0:
encoder.h: In member function ‘virtual void Encoder::UpdateDecodingOptions(const heif_image_handle*, heif_decoding_options*) const’:
encoder.h:35:70: error: unused parameter ‘handle’ [-Werror=unused-parameter]
virtual void UpdateDecodingOptions(const struct heif_image_handle* handle,
^~~~~~
encoder.h:36:37: error: unused parameter ‘options’ [-Werror=unused-parameter]
struct heif_decoding_options *options) const {
^~~~~~~
In file included from heif_thumbnailer.cc:38:0:
encoder_png.h: In member function ‘virtual heif_colorspace PngEncoder::colorspace(bool) const’:
encoder_png.h:31:35: error: unused parameter ‘has_alpha’ [-Werror=unused-parameter]
heif_colorspace colorspace(bool has_alpha) const override {
^~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:756: heif_thumbnailer-heif_thumbnailer.o] Error 1
CXX heif_thumbnailer-encoder_png.o
In file included from encoder_png.h:25:0,
from encoder_png.cc:26:
encoder.h: In member function ‘virtual void Encoder::UpdateDecodingOptions(const heif_image_handle*, heif_decoding_options*) const’:
encoder.h:35:70: error: unused parameter ‘handle’ [-Werror=unused-parameter]
virtual void UpdateDecodingOptions(const struct heif_image_handle* handle,
^~~~~~
encoder.h:36:37: error: unused parameter ‘options’ [-Werror=unused-parameter]
struct heif_decoding_options *options) const {
^~~~~~~
In file included from encoder_png.cc:26:0:
encoder_png.h: In member function ‘virtual heif_colorspace PngEncoder::colorspace(bool) const’:
encoder_png.h:31:35: error: unused parameter ‘has_alpha’ [-Werror=unused-parameter]
heif_colorspace colorspace(bool has_alpha) const override {
^~~~~~~~~
encoder_png.cc: In member function ‘virtual bool PngEncoder::Encode(const heif_image_handle*, const heif_image*, const string&)’:
encoder_png.cc:40:57: error: unused parameter ‘handle’ [-Werror=unused-parameter]
bool PngEncoder::Encode(const struct heif_image_handle* handle,
^~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:770: heif_thumbnailer-encoder_png.o] Error 1
CXX heif_test-heif_test.o
heif_test.cc: In function ‘void show_help(const char*)’:
heif_test.cc:49:28: error: unused parameter ‘argv0’ [-Werror=unused-parameter]
void show_help(const char* argv0)
^~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:728: heif_test-heif_test.o] Error 1
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/src/gnome/gimp/libheif-1.3.2/examples'
Making all in extra
make[2]: Entering directory '/src/gnome/gimp/libheif-1.3.2/extra'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/src/gnome/gimp/libheif-1.3.2/extra'
Making all in gnome
make[2]: Entering directory '/src/gnome/gimp/libheif-1.3.2/gnome'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/src/gnome/gimp/libheif-1.3.2/gnome'
Making all in go
make[2]: Entering directory '/src/gnome/gimp/libheif-1.3.2/go'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/src/gnome/gimp/libheif-1.3.2/go'
Making all in scripts
make[2]: Entering directory '/src/gnome/gimp/libheif-1.3.2/scripts'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/src/gnome/gimp/libheif-1.3.2/scripts'
make[2]: Entering directory '/src/gnome/gimp/libheif-1.3.2'
make[2]: Leaving directory '/src/gnome/gimp/libheif-1.3.2'
make[1]: *** [Makefile:507: all-recursive] Error 1
make[1]: Leaving directory '/src/gnome/gimp/libheif-1.3.2'
make: *** [Makefile:416: all] Error 2
If I understood https://golang.org/pkg/runtime/#SetFinalizer correctly, we don't need to clear the finalizers manually: This makes obj reachable again, but now without an associated finalizer.
SetFinalizer(obj, nil)
<- such function calls can likely be removed.
I built the heif_covert sample code and ran a simple test to convert an heif file to jpeg, there was no error AND no file. I had forgotten to download and install a jpeg conversion DLL.
I recommend adding the following to help others that might forget to include the conversion DLLs
file: heif_convert.cc after line 106 - insert the following
#if !(HAVE_LIBJPEG || HAVE_LIBPNG)
fprintf(stderr, "Your build does not include a PNG or JPG encoder, no conversion possible\n");
return 1;
#endif
Hi all,
Sorry if it's the wrong channel to ask this question.
I m using Imagemagick + libheif to convert heif to jpeg.
When converting an animated heif, which frame is used to convert the animated image to jpeg ?
Is it something you compute, a fix frame number or something else ?
Thank you
The README sort of implies that heif-convert can convert to PNG or JPG right out of the box but I'm finding that isn't the case. Is there something that needs to be enabled when running the configure script so JPEG support is added? I have jpeg-9c built and installed but the libheif build doesn't see it (configure: JPEG output: no). When I attempt to convert example.heic to jpg I get the following error message, "Unknown file type in example.jpg", hinting that HAVE_LIBJPEG isn't defined.
We create binaries for the @ImageMagick project with Visual Studio 2013 but that fails to build at the moment. This is failing because constexpr
is not supported. The main issue is fourcc
and the switch in Box::read
because that actually requires a constant value. This is what they use in webp:
#define MKFOURCC(a, b, c, d) ((a) | (b) << 8 | (c) << 16 | (uint32_t)(d) << 24)
I don't mind sending and testing a PR if you tell me what kind of solution you want for this.
When extracting multiple images from a HEIC file the code that creates the output filename is using find() to search out the period in the file extension from the path (see heif-convert.cc). This is a problem if the path itself has a period somewhere in it prior to the actual file,
ie; /users/username/somedirname.version/filename.ext
In the example above the '.' in "somedirname.version" will be found and changed as if it's the output file when the last period is desired. Using output_filename.find_last_of('.') would be a better solution.
The @ImageMagick project is using https://github.com/google/oss-fuzz to find bugs in our own library and in libraries that we use. The fuzzer found an issue and we think this is an issue that should be resolved in the library that we use. This issue is posted under the url https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8158 that is not publicly visible yet but added as a link for future reference. Below are the details of the issue that can be reproduced using the following technique: https://github.com/google/oss-fuzz/blob/master/docs/reproducing.md
Stacktrace:
#0 0x15b8c88 in heif::HeifContext::decode_full_grid_image(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>&, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) const libheif/libheif/heif_context.cc:987:28
--
| #1 0x15b2765 in heif::HeifContext::decode_image(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>&, heif_decoding_options const*) const libheif/libheif/heif_context.cc:822:13
| #2 0x15b07d2 in heif::HeifContext::Image::decode_image(std::__1::shared_ptr<heif::HeifPixelImage>&, heif_colorspace, heif_chroma, heif_decoding_options const*) const libheif/libheif/heif_context.cc:728:31
| #3 0x158e433 in heif_decode_image libheif/libheif/heif.cc:458:33
| #4 0x109acd2 in ReadHEICImage imagemagick/coders/heic.c:267:9
| #5 0x7d3ce9 in ReadImage imagemagick/MagickCore/constitute.c:500:13
| #6 0x6fd87a in BlobToImage imagemagick/MagickCore/blob.c:473:13
| #7 0x593661 in Magick::Image::read(Magick::Blob const&) imagemagick/Magick++/lib/Image.cpp:4029:12
| #8 0x4a4f5c in LLVMFuzzerTestOneInput imagemagick/Magick++/fuzz/encoder_fuzzer.cc:46:11
| #9 0x4ec19c in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:526:13
Links:
libheif/libheif/heif_context.cc
Line 987 in 2706077
Commit: 2706077
Testcase file: clusterfuzz-testcase-minimized-encoder_heic_fuzzer-5362068734607360.zip
CentOS Linux release 7.5.1804 (Core)
yum list installed | grep libde
libde265.x86_64 0.8-1.el7.nux @nux-dextop
libde265-debuginfo.x86_64 0.8-1.el7.nux @nux-dextop
libde265-devel.x86_64 0.8-1.el7.nux @nux-dextop
libde265-examples.x86_64 0.8-1.el7.nux @nux-dextop
Trying to build - libheif-1.3.2
Om master branch the same.
make all-recursive
make[1]: Entering directory /root/libheif-1.3.2' Making all in libheif make[2]: Entering directory
/root/libheif-1.3.2/libheif'
depbase=echo box_fuzzer.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'
;
g++ -DHAVE_CONFIG_H -I. -I.. -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT box_fuzzer.o -MD -MP -MF $depbase.Tpo -c -o box_fuzzer.o box_fuzzer.cc &&
mv -f $depbase.Tpo $depbase.Po
depbase=echo encoder_fuzzer.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'
;
g++ -DHAVE_CONFIG_H -I. -I.. -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT encoder_fuzzer.o -MD -MP -MF $depbase.Tpo -c -o encoder_fuzzer.o encoder_fuzzer.cc &&
mv -f $depbase.Tpo $depbase.Po
depbase=echo file_fuzzer.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'
;
g++ -DHAVE_CONFIG_H -I. -I.. -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT file_fuzzer.o -MD -MP -MF $depbase.Tpo -c -o file_fuzzer.o file_fuzzer.cc &&
mv -f $depbase.Tpo $depbase.Po
rm -f libfuzzers.a
ar cru libfuzzers.a box_fuzzer.o encoder_fuzzer.o file_fuzzer.o
ranlib libfuzzers.a
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-bitstream.lo -MD -MP -MF .deps/libheif_la-bitstream.Tpo -c -o libheif_la-bitstream.lo test -f 'bitstream.cc' || echo './'
bitstream.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-bitstream.lo -MD -MP -MF .deps/libheif_la-bitstream.Tpo -c bitstream.cc -fPIC -DPIC -o .libs/libheif_la-bitstream.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-bitstream.lo -MD -MP -MF .deps/libheif_la-bitstream.Tpo -c bitstream.cc -o libheif_la-bitstream.o >/dev/null 2>&1
mv -f .deps/libheif_la-bitstream.Tpo .deps/libheif_la-bitstream.Plo
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-box.lo -MD -MP -MF .deps/libheif_la-box.Tpo -c -o libheif_la-box.lo test -f 'box.cc' || echo './'
box.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-box.lo -MD -MP -MF .deps/libheif_la-box.Tpo -c box.cc -fPIC -DPIC -o .libs/libheif_la-box.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-box.lo -MD -MP -MF .deps/libheif_la-box.Tpo -c box.cc -o libheif_la-box.o >/dev/null 2>&1
mv -f .deps/libheif_la-box.Tpo .deps/libheif_la-box.Plo
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-error.lo -MD -MP -MF .deps/libheif_la-error.Tpo -c -o libheif_la-error.lo test -f 'error.cc' || echo './'
error.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-error.lo -MD -MP -MF .deps/libheif_la-error.Tpo -c error.cc -fPIC -DPIC -o .libs/libheif_la-error.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-error.lo -MD -MP -MF .deps/libheif_la-error.Tpo -c error.cc -o libheif_la-error.o >/dev/null 2>&1
mv -f .deps/libheif_la-error.Tpo .deps/libheif_la-error.Plo
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_file.lo -MD -MP -MF .deps/libheif_la-heif_file.Tpo -c -o libheif_la-heif_file.lo test -f 'heif_file.cc' || echo './'
heif_file.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_file.lo -MD -MP -MF .deps/libheif_la-heif_file.Tpo -c heif_file.cc -fPIC -DPIC -o .libs/libheif_la-heif_file.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_file.lo -MD -MP -MF .deps/libheif_la-heif_file.Tpo -c heif_file.cc -o libheif_la-heif_file.o >/dev/null 2>&1
mv -f .deps/libheif_la-heif_file.Tpo .deps/libheif_la-heif_file.Plo
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_image.lo -MD -MP -MF .deps/libheif_la-heif_image.Tpo -c -o libheif_la-heif_image.lo test -f 'heif_image.cc' || echo './'
heif_image.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_image.lo -MD -MP -MF .deps/libheif_la-heif_image.Tpo -c heif_image.cc -fPIC -DPIC -o .libs/libheif_la-heif_image.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_image.lo -MD -MP -MF .deps/libheif_la-heif_image.Tpo -c heif_image.cc -o libheif_la-heif_image.o >/dev/null 2>&1
mv -f .deps/libheif_la-heif_image.Tpo .deps/libheif_la-heif_image.Plo
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif.lo -MD -MP -MF .deps/libheif_la-heif.Tpo -c -o libheif_la-heif.lo test -f 'heif.cc' || echo './'
heif.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif.lo -MD -MP -MF .deps/libheif_la-heif.Tpo -c heif.cc -fPIC -DPIC -o .libs/libheif_la-heif.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif.lo -MD -MP -MF .deps/libheif_la-heif.Tpo -c heif.cc -o libheif_la-heif.o >/dev/null 2>&1
mv -f .deps/libheif_la-heif.Tpo .deps/libheif_la-heif.Plo
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_context.lo -MD -MP -MF .deps/libheif_la-heif_context.Tpo -c -o libheif_la-heif_context.lo test -f 'heif_context.cc' || echo './'
heif_context.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_context.lo -MD -MP -MF .deps/libheif_la-heif_context.Tpo -c heif_context.cc -fPIC -DPIC -o .libs/libheif_la-heif_context.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_context.lo -MD -MP -MF .deps/libheif_la-heif_context.Tpo -c heif_context.cc -o libheif_la-heif_context.o >/dev/null 2>&1
mv -f .deps/libheif_la-heif_context.Tpo .deps/libheif_la-heif_context.Plo
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_hevc.lo -MD -MP -MF .deps/libheif_la-heif_hevc.Tpo -c -o libheif_la-heif_hevc.lo test -f 'heif_hevc.cc' || echo './'
heif_hevc.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_hevc.lo -MD -MP -MF .deps/libheif_la-heif_hevc.Tpo -c heif_hevc.cc -fPIC -DPIC -o .libs/libheif_la-heif_hevc.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_hevc.lo -MD -MP -MF .deps/libheif_la-heif_hevc.Tpo -c heif_hevc.cc -o libheif_la-heif_hevc.o >/dev/null 2>&1
mv -f .deps/libheif_la-heif_hevc.Tpo .deps/libheif_la-heif_hevc.Plo
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_plugin_registry.lo -MD -MP -MF .deps/libheif_la-heif_plugin_registry.Tpo -c -o libheif_la-heif_plugin_registry.lo test -f 'heif_plugin_registry.cc' || echo './'
heif_plugin_registry.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_plugin_registry.lo -MD -MP -MF .deps/libheif_la-heif_plugin_registry.Tpo -c heif_plugin_registry.cc -fPIC -DPIC -o .libs/libheif_la-heif_plugin_registry.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_plugin_registry.lo -MD -MP -MF .deps/libheif_la-heif_plugin_registry.Tpo -c heif_plugin_registry.cc -o libheif_la-heif_plugin_registry.o >/dev/null 2>&1
mv -f .deps/libheif_la-heif_plugin_registry.Tpo .deps/libheif_la-heif_plugin_registry.Plo
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_plugin.lo -MD -MP -MF .deps/libheif_la-heif_plugin.Tpo -c -o libheif_la-heif_plugin.lo test -f 'heif_plugin.cc' || echo './'
heif_plugin.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_plugin.lo -MD -MP -MF .deps/libheif_la-heif_plugin.Tpo -c heif_plugin.cc -fPIC -DPIC -o .libs/libheif_la-heif_plugin.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_plugin.lo -MD -MP -MF .deps/libheif_la-heif_plugin.Tpo -c heif_plugin.cc -o libheif_la-heif_plugin.o >/dev/null 2>&1
mv -f .deps/libheif_la-heif_plugin.Tpo .deps/libheif_la-heif_plugin.Plo
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_decoder_libde265.lo -MD -MP -MF .deps/libheif_la-heif_decoder_libde265.Tpo -c -o libheif_la-heif_decoder_libde265.lo test -f 'heif_decoder_libde265.cc' || echo './'
heif_decoder_libde265.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_decoder_libde265.lo -MD -MP -MF .deps/libheif_la-heif_decoder_libde265.Tpo -c heif_decoder_libde265.cc -fPIC -DPIC -o .libs/libheif_la-heif_decoder_libde265.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT libheif_la-heif_decoder_libde265.lo -MD -MP -MF .deps/libheif_la-heif_decoder_libde265.Tpo -c heif_decoder_libde265.cc -o libheif_la-heif_decoder_libde265.o >/dev/null 2>&1
mv -f .deps/libheif_la-heif_decoder_libde265.Tpo .deps/libheif_la-heif_decoder_libde265.Plo
/bin/sh ../libtool --tag=CXX --mode=link g++ -fvisibility=hidden -DLIBHEIF_EXPORTS -I.. -DHAVE_VISIBILITY -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -version-info 4:2:3 -o libheif.la -rpath /usr/local/lib libheif_la-bitstream.lo libheif_la-box.lo libheif_la-error.lo libheif_la-heif_file.lo libheif_la-heif_image.lo libheif_la-heif.lo libheif_la-heif_context.lo libheif_la-heif_hevc.lo libheif_la-heif_plugin_registry.lo libheif_la-heif_plugin.lo libheif_la-heif_decoder_libde265.lo -lde265 -lpthread
libtool: link: rm -fr .libs/libheif.a .libs/libheif.la .libs/libheif.lai .libs/libheif.so .libs/libheif.so.1 .libs/libheif.so.1.3.2
libtool: link: g++ -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginS.o .libs/libheif_la-bitstream.o .libs/libheif_la-box.o .libs/libheif_la-error.o .libs/libheif_la-heif_file.o .libs/libheif_la-heif_image.o .libs/libheif_la-heif.o .libs/libheif_la-heif_context.o .libs/libheif_la-heif_hevc.o .libs/libheif_la-heif_plugin_registry.o .libs/libheif_la-heif_plugin.o .libs/libheif_la-heif_decoder_libde265.o -lde265 -lpthread -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o -O2 -Wl,-soname -Wl,libheif.so.1 -o .libs/libheif.so.1.3.2
libtool: link: (cd ".libs" && rm -f "libheif.so.1" && ln -s "libheif.so.1.3.2" "libheif.so.1")
libtool: link: (cd ".libs" && rm -f "libheif.so" && ln -s "libheif.so.1.3.2" "libheif.so")
libtool: link: ar cru .libs/libheif.a libheif_la-bitstream.o libheif_la-box.o libheif_la-error.o libheif_la-heif_file.o libheif_la-heif_image.o libheif_la-heif.o libheif_la-heif_context.o libheif_la-heif_hevc.o libheif_la-heif_plugin_registry.o libheif_la-heif_plugin.o libheif_la-heif_decoder_libde265.o
libtool: link: ranlib .libs/libheif.a
libtool: link: ( cd ".libs" && rm -f "libheif.la" && ln -s "../libheif.la" "libheif.la" )
make[2]: Leaving directory /root/libheif-1.3.2/libheif' Making all in examples make[2]: Entering directory
/root/libheif-1.3.2/examples'
g++ -DHAVE_CONFIG_H -I. -I.. -I.. -I../. -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT heif_convert-encoder.o -MD -MP -MF .deps/heif_convert-encoder.Tpo -c -o heif_convert-encoder.o test -f 'encoder.cc' || echo './'
encoder.cc
mv -f .deps/heif_convert-encoder.Tpo .deps/heif_convert-encoder.Po
g++ -DHAVE_CONFIG_H -I. -I.. -I.. -I../. -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT heif_convert-heif_convert.o -MD -MP -MF .deps/heif_convert-heif_convert.Tpo -c -o heif_convert-heif_convert.o test -f 'heif_convert.cc' || echo './'
heif_convert.cc
mv -f .deps/heif_convert-heif_convert.Tpo .deps/heif_convert-heif_convert.Po
g++ -DHAVE_CONFIG_H -I. -I.. -I.. -I../. -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT heif_convert-encoder_jpeg.o -MD -MP -MF .deps/heif_convert-encoder_jpeg.Tpo -c -o heif_convert-encoder_jpeg.o test -f 'encoder_jpeg.cc' || echo './'
encoder_jpeg.cc
mv -f .deps/heif_convert-encoder_jpeg.Tpo .deps/heif_convert-encoder_jpeg.Po
/bin/sh ../libtool --tag=CXX --mode=link g++ -I.. -I../. -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -o heif-convert heif_convert-encoder.o heif_convert-heif_convert.o heif_convert-encoder_jpeg.o ../libheif/libheif.la -ljpeg -lpthread
libtool: link: g++ -I.. -I../. -g -O2 -std=gnu++11 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -o .libs/heif-convert heif_convert-encoder.o heif_convert-heif_convert.o heif_convert-encoder_jpeg.o ../libheif/.libs/libheif.so -lde265 -ljpeg -lpthread -Wl,-rpath -Wl,/usr/local/lib
../libheif/.libs/libheif.so: undefined reference to de265_get_bits_per_pixel' collect2: error: ld returned 1 exit status make[2]: *** [heif-convert] Error 1 make[2]: Leaving directory
/root/libheif-1.3.2/examples'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/libheif-1.3.2'
make: *** [all] Error 2
The @ImageMagick project is using https://github.com/google/oss-fuzz to find bugs in our own library and in libraries that we use. The fuzzer found an issue and we think this is an issue that should be resolved in the library that we use. This issue is posted under the url https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9244 that is not publicly visible yet but added as a link for future reference. Below are the details of the issue that can be reproduced using the following technique: https://github.com/google/oss-fuzz/blob/master/docs/reproducing.md
Stacktrace:
bitstream.cc:301:48: runtime error: signed integer overflow: 16 + 9223372036854775797 cannot be represented in type 'long'
--
| #0 0x93c48d in heif::BitstreamRange::wait_for_available_bytes(long) libheif/libheif/bitstream.cc:301:48
| #1 0x943af7 in heif::Box::read(heif::BitstreamRange&, std::__1::shared_ptr<heif::Box>*) libheif/libheif/box.cc:465:23
| #2 0x97df7b in heif::HeifFile::parse_heif_file(heif::BitstreamRange&) libheif/libheif/heif_file.cc:166:19
| #3 0x97db94 in heif::HeifFile::read(std::__1::shared_ptr<heif::StreamReader>) libheif/libheif/heif_file.cc:82:17
| #4 0x97de51 in heif::HeifFile::read_from_memory(void const*, unsigned long, bool) libheif/libheif/heif_file.cc:71:10
| #5 0x91f77c in heif::HeifContext::read_from_memory(void const*, unsigned long, bool) libheif/libheif/heif_context.cc:357:28
| #6 0x90910e in heif_context_read_from_memory libheif/libheif/heif.cc:107:29
| #7 0x7b3f29 in ReadHEICImage imagemagick/coders/heic.c:195:9
| #8 0x544570 in ReadImage imagemagick/MagickCore/constitute.c:500:13
| #9 0x6724cb in ReadStream imagemagick/MagickCore/stream.c:1043:9
Links:
Line 301 in 01fe0a8
Commit: 1fe0a821d5feefb5e8cdefbf2310a07b25b04a8
Testcase file: clusterfuzz-testcase-minimized-ping_heic_fuzzer-5764869918818304.zip
We have address fault error on openning alpha item. And test on gimp and error appears on gimp too.
Steps:
Plug-in crashed: "file-heif"
(/Applications/Gimp-2.10.app/Contents/Resources/lib/gimp/2.0/plug-ins/file-heif)
The dying plug-in may have messed up GIMP's internal state. You may want to save your images and restart GIMP to be on the safe side.
Do you any plan add to libheif support > 10-16 bit and 4:4:4 chroma subsampling ?
i have ubuntu 16.04 , can i install libheif with apt-get instead of cloning this git repository and run ./configure
, make
and make install
?
As reported in #25 there have been errors when cross-compiling using mingw32. We should cover that with Travis.
The attached file (and others) convert fine using the sample heif-convert program (to png) on macOS (10.12.6
IMG_4453.HEIC.zip), but give "Could not read HEIF file: Invalid input: No 'meta' box" on Windows (7 and 10). I can clearly see the "meta" box tag in a hex editor:
bbmbp081:~ vico$ xxd -l 128 projects/apple_formats/media/Archive_from_MikeH/Archive/IMG_4453.HEIC
00000000: 0000 0018 6674 7970 6865 6963 0000 0000 ....ftypheic....
00000010: 6d69 6631 6865 6963 0000 0f74 6d65 7461 mif1heic...tmeta
00000020: 0000 0000 0000 0022 6864 6c72 0000 0000 ......."hdlr....
Any ideas? (I had to zip the file to attach it.)
Hi!
At GIMP's we had a report about a file wrongly interpreted as HEIC because of the wrong extension. Normally we are able to avoid this kind of error if we add magic number detection.
I couldn't get clear details about what can be considered as HEIC/HEIF magic number. Looking at a few sample images, I found that the string "ftyp" at the 5th bytes seems like a constant in every HEIC/HEIF file. Yet since I understand that HEIC/HEIF is a subformat of ISOBMFF, it looks like this magic number would also detect non-HEIC files which are ISOBMFF, right? At least it also worked with a .mov
file (unfortunately!).
In the various HEIC files I could find, the longer string was either ftypmif1
or ftypheic
. Would both these strings qualify as good magic numbers? Can there be other variants?
All the files I had in my possession also had the string mif1heic
at the 16th byte. Is it also a confirmed constant? Can I use this as magic keyword instead?
Thanks! :-)
ImageMagick has used libheif to support HEVC format. Note that it sets hevc encoder is thread support, but decoder is not. I’m here to confirm whether this assumption is correct. Libheif doc does’t mention anything about it.
In file included from interface.h:25,
from interface.c:28:
/usr/local/include/libheif/heif.h:299:3: error: expected specifier-qualifier-list before ‘heif_reader_grow_status’
heif_reader_grow_status (wait_for_file_size)(int64_t target_size, void userdata);
^~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:422: heif_gimp_plugin-interface.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from interface.h:25,
from main.c:30:
/usr/local/include/libheif/heif.h:299:3: error: expected specifier-qualifier-list before ‘heif_reader_grow_status’
heif_reader_grow_status (wait_for_file_size)(int64_t target_size, void userdata);
^~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:436: heif_gimp_plugin-main.o] Error 1
make[2]: Leaving directory '/usr/src/strukturag/heif-gimp-plugin/src'
Hello all,
Will libheif support heif sequence file?
I downloaded samples from https://github.com/nokiatech/heif and tried to display the heif sequence file( bird_burst.heic in image_sequences folder).
From the heif-info program, it shows up 4 still images but no burst images.
I dug the libheif and found no moov box implementation.
So I think currently not support for heif sequence file? Will it support in the feature? Thanks
- writer.write16(c.min_spatial_segmentation_idc & 0x0FFF);
+ writer.write16((c.min_spatial_segmentation_idc & 0x0FFF) | 0xF000);
aligned(8) class HEVCDecoderConfigurationRecord {
(omit)
bit(4) reserved = ‘1111’b;
unsigned int(12) min_spatial_segmentation_idc;
(omit)
To prevent future regressions of problems like the error in #35 we should compile a small C application that is using the header files.
Building within subdirectory still fails.
Steps to reproduce:
cd /usr/src/1div0/libheif/Linux/x86-64
../../configure --prefix=/usr/local --libdir=/usr/local/lib64
make
make all-recursive
make[1]: Entering directory '/usr/src/1div0/libheif/Linux/x86-64'
Making all in libheif
make[2]: Entering directory '/usr/src/1div0/libheif/Linux/x86-64/libheif'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/usr/src/1div0/libheif/Linux/x86-64/libheif'
Making all in examples
make[2]: Entering directory '/usr/src/1div0/libheif/Linux/x86-64/examples'
g++ -DHAVE_CONFIG_H -I. -I../../../examples -I.. -I../../.. -I../. -I/usr/include/libpng16 -g -O2 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -MT heif_convert-encoder.o -MD -MP -MF .deps/heif_convert-encoder.Tpo -c -o heif_convert-encoder.o test -f 'encoder.cc' || echo '../../../examples/'
encoder.cc
In file included from ../../../examples/encoder.h:26,
from ../../../examples/encoder.cc:30:
../../../libheif/heif.h:31:10: fatal error: heif_version.h: No such file or directory
#include "heif_version.h"
^~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:643: heif_convert-encoder.o] Error 1
make[2]: Leaving directory '/usr/src/1div0/libheif/Linux/x86-64/examples'
make[1]: *** [Makefile:506: all-recursive] Error 1
make[1]: Leaving directory '/usr/src/1div0/libheif/Linux/x86-64'
make: *** [Makefile:415: all] Error 2
After upgrading from libjpeg-turbo 1.5.3 to 2.0.0 from https://github.com/libjpeg-turbo/libjpeg-turbo/releases/tag/2.0.0, libheif fails to build:
(min) hmage@min:~/norm.x86_64-pc-linux-gnu.2.24.haswell.min/tmp/compile/libheif/libheif_libheif-1.3.2.tar.gz$ make
make all-recursive
make[1]: Entering directory '/home/hmage/norm.x86_64-pc-linux-gnu.2.24.haswell.min/tmp/compile/libheif/libheif_libheif-1.3.2.tar.gz'
Making all in libheif
make[2]: Entering directory '/home/hmage/norm.x86_64-pc-linux-gnu.2.24.haswell.min/tmp/compile/libheif/libheif_libheif-1.3.2.tar.gz/libheif'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/hmage/norm.x86_64-pc-linux-gnu.2.24.haswell.min/tmp/compile/libheif/libheif_libheif-1.3.2.tar.gz/libheif'
Making all in examples
make[2]: Entering directory '/home/hmage/norm.x86_64-pc-linux-gnu.2.24.haswell.min/tmp/compile/libheif/libheif_libheif-1.3.2.tar.gz/examples'
c++ -DHAVE_CONFIG_H -I. -I.. -I/home/hmage/norm.x86_64-pc-linux-gnu.2.24.haswell.min/include -march=native -fdebug-prefix-map=/home/hmage/norm.x86_64-pc-linux-gnu.2.24.haswell.min=/build -ffunction-sections -fdata-sections -I.. -I../. -g -O2 -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -c -o heif_convert-heif_convert.o `test -f 'heif_convert.cc' || echo './'`heif_convert.cc
In file included from /home/hmage/norm.x86_64-pc-linux-gnu.2.24.haswell.min/include/jpeglib.h:29:0,
from encoder_jpeg.h:27,
from heif_convert.cc:38:
/home/hmage/norm.x86_64-pc-linux-gnu.2.24.haswell.min/include/jconfig.h:39:0: error: "HAVE_STDDEF_H" redefined [-Werror]
#define HAVE_STDDEF_H
In file included from heif_convert.cc:21:0:
../config.h:38:0: note: this is the location of the previous definition
#define HAVE_STDDEF_H 1
In file included from /home/hmage/norm.x86_64-pc-linux-gnu.2.24.haswell.min/include/jpeglib.h:29:0,
from encoder_jpeg.h:27,
from heif_convert.cc:38:
/home/hmage/norm.x86_64-pc-linux-gnu.2.24.haswell.min/include/jconfig.h:42:0: error: "HAVE_STDLIB_H" redefined [-Werror]
#define HAVE_STDLIB_H
In file included from heif_convert.cc:21:0:
../config.h:44:0: note: this is the location of the previous definition
#define HAVE_STDLIB_H 1
cc1plus: all warnings being treated as errors
Makefile:662: recipe for target 'heif_convert-heif_convert.o' failed
make[2]: *** [heif_convert-heif_convert.o] Error 1
make[2]: Leaving directory '/home/hmage/norm.x86_64-pc-linux-gnu.2.24.haswell.min/tmp/compile/libheif/libheif_libheif-1.3.2.tar.gz/examples'
Makefile:507: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/hmage/norm.x86_64-pc-linux-gnu.2.24.haswell.min/tmp/compile/libheif/libheif_libheif-1.3.2.tar.gz'
Makefile:416: recipe for target 'all' failed
make: *** [all] Error 2
Didn't have time yet to track down exactly why, but better have the bugreport rather than not.
PNG -> HEIC lossless -> PNG = does not equal original image.
We should update the AppVeyor tests to also build the plugins on Windows. This will help catching errors like #9 in the future.
The function HeifContext::is_grid_item
is checking twice for !m_is_primary
:
libheif/libheif/heif_context.h
Line 161 in 3245495
Can the duplicated check simply be removed, or should it check for something else?
This was found by Coverity Scan.
The @ImageMagick project is using https://github.com/google/oss-fuzz to find bugs in our own library and in libraries that we use. The fuzzer found an issue and we think this is an issue that should be resolved in the library that we use. This issue is posted under the url https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8871 that is not publicly visible yet but added as a link for future reference. Below are the details of the issue that can be reproduced using the following technique: https://github.com/google/oss-fuzz/blob/master/docs/reproducing.md
Stacktrace:
==1==ERROR: AddressSanitizer: negative-size-param: (size=-320)
--
| SCARINESS: 10 (negative-size-param)
| #0 0x4ebcd3 in __asan_memcpy _asan_rtl_
| #1 0xda345d in heif::HeifContext::decode_and_paste_tile_image(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const libheif/libheif/heif_context.cc:1092:7
| #2 0xdb1a0a in __invoke<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int, void> /usr/local/include/c++/v1/type_traits:4286:1
| #3 0xdb1a0a in heif::Error std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int>::__execute<1ul, 2ul, 3ul, 4ul, 5ul>(std::__1::__tuple_indices<1ul, 2ul, 3ul, 4ul, 5ul>) /usr/local/include/c++/v1/future:2330
| #4 0xdb1788 in std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int>::operator()() /usr/local/include/c++/v1/future:2323:16
| #5 0xdb0f6a in std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >::__execute() /usr/local/include/c++/v1/future:985:25
| #6 0xdb1c64 in __invoke<void (std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >::*)(), std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> > *, void> /usr/local/include/c++/v1/type_traits:4286:1
| #7 0xdb1c64 in __thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >::*)(), std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, const heif::HeifContext *, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> > *, 2> /usr/local/include/c++/v1/thread:342
| #8 0xdb1c64 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >::*)(), std::__1::__async_assoc_state<heif::Error, std::__1::__async_func<heif::Error (heif::HeifContext::*)(unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int) const, heif::HeifContext const*, unsigned int, std::__1::shared_ptr<heif::HeifPixelImage>, int, int> >*> >(void*) /usr/local/include/c++/v1/thread:352
| #9 0x7fb17f2ab6b9 in start_thread
| #10 0x7fb17e9bf41c in clone /build/glibc-Cl5G7W/glibc-2.23/sysdeps/unix/sysv/linux/x86_64/clone.S:109
| 0x7fb17b40d800 is located 0 bytes inside of 262144-byte region [0x7fb17b40d800,0x7fb17b44d800)
| allocated by thread T4 here:
| #0 0x52b3f8 in operator new(unsigned long) _asan_rtl_
| #1 0xdb2b68 in __libcpp_allocate /usr/local/include/c++/v1/new:259:10
| #2 0xdb2b68 in allocate /usr/local/include/c++/v1/memory:1799
Links:
libheif/libheif/heif_context.cc
Line 1092 in 647b06f
Commit: 2706077
Testcase file: clusterfuzz-testcase-minimized-encoder_heic_fuzzer-5666980618043392.zip
In #64 the CI fuzzer found two potential errors:
https://travis-ci.org/strukturag/libheif/jobs/418152399
https://travis-ci.org/strukturag/libheif/jobs/418152401
Please investigate if this is still an error or was already fixed in master.
The @ImageMagick project is using https://github.com/google/oss-fuzz to find bugs in our own library and in libraries that we use. The fuzzer found an issue and we think this is an issue that should be resolved in the library that we use. This issue is posted under the url https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8136 that is not publicly visible yet but added as a link for future reference. Below are the details of the issue that can be reproduced using the following technique: https://github.com/google/oss-fuzz/blob/master/docs/reproducing.md
Stacktrace:
==1==ERROR: AddressSanitizer: stack-overflow on address 0x7ffdcfa72ff8 (pc 0x000000db0f88 bp 0x7ffdcfa73010 sp 0x7ffdcfa73000 T0)
--
| SCARINESS: 10 (stack-overflow)
| #0 0xdb0f87 in heif::BitstreamRange::read(unsigned long) libheif/src/bitstream.h:65
| #1 0xdb1055 in heif::BitstreamRange::read(unsigned long) libheif/src/bitstream.h:68:27
| #2 0xdb1055 in heif::BitstreamRange::read(unsigned long) libheif/src/bitstream.h:68:27
| #3 0xdb1055 in heif::BitstreamRange::read(unsigned long) libheif/src/bitstream.h:68:27
| #4 0xdb1055 in heif::BitstreamRange::read(unsigned long) libheif/src/bitstream.h:68:27
| #5 0xdb1055 in heif::BitstreamRange::read(unsigned long) libheif/src/bitstream.h:68:27
| #6 0xdb1055 in heif::BitstreamRange::read(unsigned long) libheif/src/bitstream.h:68:27
| #7 0xdb1055 in heif::BitstreamRange::read(unsigned long) libheif/src/bitstream.h:68:27
| #8 0xdb1055 in heif::BitstreamRange::read(unsigned long) libheif/src/bitstream.h:68:27
Links:
Line 65 in 0a0db99
Line 68 in 0a0db99
Commit: 0a0db99
Testcase file: clusterfuzz-testcase-minimized-ping_heic_fuzzer-4721040704929792.zip
hi,I get bitstream through the nokiatech/heif library. How do I turn bitstream into rgba data?thank you!
Hello,
I have another one of those cursed autoconfig error messages:
$ pkg-config --version
0.29.2
$ git pull
$ ./autogen.sh
hook ...
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: running: /usr/local/bin/autoconf --force
configure.ac:40: error: possibly undefined macro: AC_CHECK_HEADER_STDBOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/local/bin/autoconf failed with exit status: 1
In a previous step I could build libde265 successfully though.
Thanks for your support!
Axel.
We got an issue reported for ImageMagick (ImageMagick/ImageMagick#1131) about a crash when reading an heic image multithreaded. Is this a bug in the library or should we make sure that heic images are always read in a single thread?
The @ImageMagick project is using https://github.com/google/oss-fuzz to find bugs in our own library and in libraries that we use. The fuzzer found an issue and we think this is an issue that should be resolved in the library that we use. This issue is posted under the url https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8922 that is not publicly visible yet but added as a link for future reference. Below are the details of the issue that can be reproduced using the following technique: https://github.com/google/oss-fuzz/blob/master/docs/reproducing.md
Stacktrace:
SCARINESS: 10 (signal)
--
| #0 0x7f35ed949427 in gsignal /build/glibc-Cl5G7W/glibc-2.23/sysdeps/unix/sysv/linux/raise.c:54
| #1 0x7f35ed94b029 in abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:89
| #2 0x7f35ed941bd6 in __assert_fail_base /build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:92
| #3 0x7f35ed941c81 in __assert_fail /build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:101
| #4 0xdc8aef in heif::BitstreamRange::prepare_read(long) libheif/libheif/bitstream.cc:274:5
| #5 0xdce843 in heif::Box::parse(heif::BitstreamRange&) libheif/libheif/box.cc:312:15
| #6 0xdd0d84 in heif::Box::read(heif::BitstreamRange&, std::__1::shared_ptr<heif::Box>*) libheif/libheif/box.cc:476:20
| #7 0xe05df5 in heif::HeifFile::parse_heif_file(heif::BitstreamRange&) libheif/libheif/heif_file.cc:166:19
| #8 0xe05368 in heif::HeifFile::read(std::__1::shared_ptr<heif::StreamReader>) libheif/libheif/heif_file.cc:82:17
| #9 0xe056d8 in heif::HeifFile::read_from_memory(void const*, unsigned long, bool) libheif/libheif/heif_file.cc:71:10
| #10 0xda0796 in heif::HeifContext::read_from_memory(void const*, unsigned long, bool) libheif/libheif/heif_context.cc:357:28
| #11 0xd8812d in heif_context_read_from_memory libheif/libheif/heif.cc:107:29
| #12 0xae518e in ReadHEICImage imagemagick/coders/heic.c:195:9
Links:
Line 274 in 2706077
Commit: 2706077
Testcase file: clusterfuzz-testcase-minimized-ping_heic_fuzzer-5723660210929664.zip
please refer to the issue https://github.com/ImageMagick/ImageMagick/issues/1173
when I resize a heic file by imagemagick, I got an error as below:
suse11sp1:~/lzz # convert -resize 120x120 20171218_IMG_0449.HEIC 20171218_IMG_0449.jpg terminate called after throwing an instance of 'std::system_error' what(): Resource temporarily unavailable Aborted
and I find that the error is related to the heic file size.
when the file size is 1.4M, I can resize the file right.
but when the file size is 5.5M, I got the errors.
`suse11sp1:~/lzz # ll -h
total 30M
-rw-r--r-- 1 root root 1.4M Dec 18 08:41 20171218_IMG_0446.HEIC
-rw-r--r-- 1 root root 5.5M Dec 18 08:41 20171218_IMG_0449.HEIC
-rw-r--r-- 1 root root 595K Dec 18 08:41 20171218_IMG_0455.HEIC
-rw-r--r-- 1 root root 66K Jun 14 06:01 20171218_IMG_0455.jpg
suse11sp1:/lzz # convert -resize 120x120 20171218_IMG_0446.HEIC 20171218_IMG_0446.jpg
suse11sp1:/lzz # convert -resize 120x120 20171218_IMG_0449.HEIC 20171218_IMG_0449.jpg
terminate called after throwing an instance of 'std::system_error'
what(): Resource temporarily unavailable
Aborted`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.