Skip to content

Commit

Permalink
The box_size_without_header must be positive. Else throw an error
Browse files Browse the repository at this point in the history
  • Loading branch information
dukesook committed Oct 26, 2023
1 parent 0744e74 commit d85b881
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libheif/box.cc
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ Error Box::read(BitstreamRange& range, std::shared_ptr<Box>* result)

// Box size may not be larger than remaining bytes in parent box.

if ((int64_t)range.get_remaining_bytes() < box_size_without_header) {
if ((int64_t)range.get_remaining_bytes() < box_size_without_header || box_size_without_header < 0) {
return Error(heif_error_Invalid_input,
heif_suberror_Invalid_box_size);
}
Expand Down

0 comments on commit d85b881

Please sign in to comment.