Skip to content

Commit

Permalink
Merge pull request #2394 from kevinbackhouse/fix-issue-2393
Browse files Browse the repository at this point in the history
stop looping when eof is hit
  • Loading branch information
kevinbackhouse authored Oct 30, 2022
2 parents 28d1880 + 771ead8 commit d599d36
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/quicktimevideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1221,12 +1221,13 @@ void QuickTimeVideo::multipleEntriesDecoder() {
DataBuf buf(4 + 1);
io_->readOrThrow(buf.data(), 4);
io_->readOrThrow(buf.data(), 4);
size_t noOfEntries;
uint32_t noOfEntries;

noOfEntries = buf.read_uint32(0, bigEndian);

for (unsigned long i = 1; i <= noOfEntries; i++)
for (uint32_t i = 0; i < noOfEntries && continueTraversing_; i++) {
decodeBlock();
}
} // QuickTimeVideo::multipleEntriesDecoder

void QuickTimeVideo::videoHeaderDecoder(size_t size) {
Expand Down
Binary file added test/data/issue_2393_poc.mp4
Binary file not shown.
16 changes: 16 additions & 0 deletions tests/bugfixes/github/test_issue_2393.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

from system_tests import CaseMeta, check_no_ASAN_UBSAN_errors

class issue_2393_QuickTimeVideo_multipleEntriesDecoder_long_running(metaclass=CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/2393"
filename = "$data_path/issue_2393_poc.mp4"
commands = ["$exiv2 $filename"]
retval = [253]
stderr = ["""$filename: No Exif data found in the file
"""]
stdout = ["""File name : $filename
File size : 319 Bytes
MIME type : video/quicktime
Image size : 0 x 0
"""]
1 change: 1 addition & 0 deletions tests/regression_tests/test_regression_allfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def get_valid_files(data_dir):
"issue_2376_poc.mp4",
"issue_2377_poc.mp4",
"issue_2383_poc.mp4",
"issue_2393_poc.mp4",
"2018-01-09-exiv2-crash-001.tiff",
"cve_2017_1000126_stack-oob-read.webp",
"exiv2-bug1247.jpg",
Expand Down

0 comments on commit d599d36

Please sign in to comment.