Skip to content

Commit

Permalink
prevent integer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Oct 20, 2024
1 parent 9674b65 commit ed8b034
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libheif/codecs/uncompressed/unc_boxes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ Error Box_icef::parse(BitstreamRange& range, const heif_security_limits* limits)

// --- check if box is large enough for all the data

uint64_t data_size_bytes = num_compressed_units * (unit_offset_bits + unit_size_bits) / 8;
uint64_t data_size_bytes = static_cast<uint64_t>(num_compressed_units) * (unit_offset_bits + unit_size_bits) / 8;
if (data_size_bytes > range.get_remaining_bytes()) {
uint64_t contained_units = range.get_remaining_bytes() / ((unit_offset_bits + unit_size_bits) * 8);
std::stringstream sstr;
Expand Down

0 comments on commit ed8b034

Please sign in to comment.