Skip to content

Commit

Permalink
Bring back overflow check removed in 29bc4c3
Browse files Browse the repository at this point in the history
  • Loading branch information
fancycode committed Jul 4, 2024
1 parent 73f23a1 commit b34e7ac
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions libheif/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,17 @@ Error HeifContext::interpret_heif_file()
uint32_t width = ispe->get_width();
uint32_t height = ispe->get_height();

uint32_t max_width_height = static_cast<uint32_t>(std::numeric_limits<int>::max());
if (width >= max_width_height || height >= max_width_height) {
std::stringstream sstr;
sstr << "Image size " << width << "x" << height << " exceeds the maximum image size "
<< m_maximum_image_size_limit << "\n";

return Error(heif_error_Memory_allocation_error,
heif_suberror_Security_limit_exceeded,
sstr.str());
}

image->set_resolution(width, height);
ispe_read = true;
}
Expand Down

0 comments on commit b34e7ac

Please sign in to comment.