Skip to content

Commit

Permalink
fix HeifContext::has_alpha() for broken input (fixes #1305)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Sep 11, 2024
1 parent 4e9eb8e commit e962b59
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libheif/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,6 @@ Error HeifContext::interpret_heif_file()

bool HeifContext::has_alpha(heif_item_id ID) const
{

assert(is_image(ID));
auto img = m_all_images.find(ID)->second;

Expand All @@ -843,7 +842,10 @@ bool HeifContext::has_alpha(heif_item_id ID) const

heif_colorspace colorspace;
heif_chroma chroma;
img->get_coded_image_colorspace(&colorspace, &chroma);
Error err = img->get_coded_image_colorspace(&colorspace, &chroma);
if (err) {
return false;
}

if (chroma == heif_chroma_interleaved_RGBA ||
chroma == heif_chroma_interleaved_RRGGBBAA_BE ||
Expand Down

0 comments on commit e962b59

Please sign in to comment.