Skip to content

Commit

Permalink
skip depth and alpha map references to non-images (#1190)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Jul 1, 2024
1 parent 0dcadb9 commit 3a6f8cd
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions libheif/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -750,9 +750,14 @@ Error HeifContext::interpret_heif_file()
for (heif_item_id ref: refs) {
auto master_iter = m_all_images.find(ref);
if (master_iter == m_all_images.end()) {
return Error(heif_error_Invalid_input,
heif_suberror_Nonexisting_item_referenced,
"Non-existing alpha image referenced");

if (!m_heif_file->has_item_with_id(ref)) {
return Error(heif_error_Invalid_input,
heif_suberror_Nonexisting_item_referenced,
"Non-existing alpha image referenced");
}

continue;
}

auto master_img = master_iter->second;
Expand All @@ -778,9 +783,14 @@ Error HeifContext::interpret_heif_file()
for (heif_item_id ref: refs) {
auto master_iter = m_all_images.find(ref);
if (master_iter == m_all_images.end()) {
return Error(heif_error_Invalid_input,
heif_suberror_Nonexisting_item_referenced,
"Non-existing depth image referenced");

if (!m_heif_file->has_item_with_id(ref)) {
return Error(heif_error_Invalid_input,
heif_suberror_Nonexisting_item_referenced,
"Non-existing depth image referenced");
}

continue;
}
if (image.get() == master_iter->second.get()) {
return Error(heif_error_Invalid_input,
Expand Down

0 comments on commit 3a6f8cd

Please sign in to comment.