Open dukesook opened 1 month ago
When heif_context* doesn't read from a file, HeifFile::m_input_stream never initialized. Therefore, calling heif_decode_image() results in an unexpected Segmentation Fault.
HeifFile::m_input_stream
heif_decode_image()
// Read HEIF heif_context* ctx_read = heif_context_alloc(); heif_context_read_from_file(ctx_read, filename, nullptr); heif_image_handle* handle; heif_context_get_primary_image_handle(ctx_read, &handle); heif_image* img; heif_decode_image(handle, &img, heif_colorspace_RGB, heif_chroma_interleaved_RGB, nullptr); // Write HEIF heif_encoder* encoder; heif_context* ctx_write = heif_context_alloc(); heif_context_get_encoder_for_format(ctx_write, heif_compression_HEVC, &encoder); // 1. Encode image heif_context_encode_image(ctx_write, img, encoder, nullptr, &handle); // 2. Get image back heif_decode_image(handle, &img, heif_colorspace_RGB, heif_chroma_interleaved_RGB, nullptr); // SEGFAULT
I would like this to work, or at least have struct heif_error catch it.
struct heif_error
When heif_context* doesn't read from a file,
HeifFile::m_input_stream
never initialized. Therefore, callingheif_decode_image()
results in an unexpected Segmentation Fault.I would like this to work, or at least have
struct heif_error
catch it.