Skip to content

Commit

Permalink
fix parse error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Oct 18, 2023
1 parent 20ad9fb commit feb3cee
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions libheif/file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,19 @@ Error HeifFile::parse_heif_file(BitstreamRange& range)
std::shared_ptr<Box> box;
Error error = Box::read(range, &box);

if (range.error() || range.eof()) {
break;
}

// When an EOF error is returned, this is not really a fatal exception,
// but simply the indication that we reached the end of the file.
if (error != Error::Ok) {
return error;
// TODO: this design should be cleaned up
if (error.error_code == heif_error_Invalid_input && error.sub_error_code == heif_suberror_End_of_data) {
break;
}

if (range.error() || range.eof()) {
break;
if (error != Error::Ok) {
return error;
}

m_top_level_boxes.push_back(box);
Expand Down

0 comments on commit feb3cee

Please sign in to comment.