Skip to content
Permalink
Browse files Browse the repository at this point in the history
Detect non-existing referenced alpha images (fixes #123)
  • Loading branch information
fancycode committed Apr 15, 2019
1 parent dcbfa77 commit 995a428
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Binary file added fuzzing/corpus/uaf_heif_context.h_117_1.heic
Binary file not shown.
5 changes: 5 additions & 0 deletions libheif/heif_context.cc
Expand Up @@ -576,6 +576,11 @@ Error HeifContext::interpret_heif_file()
image->set_is_alpha_channel_of(refs[0]);

auto master_iter = m_all_images.find(refs[0]);
if (master_iter == m_all_images.end()) {
return Error(heif_error_Invalid_input,
heif_suberror_Nonexisting_item_referenced,
"Non-existing alpha image referenced");
}
if (image.get() == master_iter->second.get()) {
return Error(heif_error_Invalid_input,
heif_suberror_Nonexisting_item_referenced,
Expand Down

0 comments on commit 995a428

Please sign in to comment.