Skip to content

Commit

Permalink
ispe size should be checked against the correct limit (#1359)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Nov 1, 2024
1 parent e563eb6 commit 3a50c49
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions libheif/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,15 +425,9 @@ 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 "
<< get_security_limits()->max_image_size_pixels << "\n";

return Error(heif_error_Memory_allocation_error,
heif_suberror_Security_limit_exceeded,
sstr.str());
Error sizeError = check_for_valid_image_size(get_security_limits(), width, height);
if (sizeError) {
return sizeError;
}

image->set_resolution(width, height);
Expand Down

0 comments on commit 3a50c49

Please sign in to comment.