-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix long-running loop in QuickTimeVideo::sampleDesc #2424
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to do something about the comment I have made or not, it is just a suggestion. Everything else looks good!
io_->readOrThrow(buf.data(), 4); | ||
temp = buf.read_uint32(0, bigEndian); | ||
const uint64_t temp = buf.read_uint32(0, bigEndian); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it makes sense to treat the variable temp
as uint64_t
when we are reading here a uint32_t
? Since we are talking about frames in a video, I doubt we will ever need to process such a large video to need uint64_t
for the totalFrames :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did that because of the multiplication two lines later:
Line 1106 in cf15cc5
timeOfFrames += temp * buf.read_uint32(0, bigEndian); |
If temp
is a uint64_t
then the multiplication can't overflow. (Probably not a big deal if it does overflow, but I figure we might as well avoid it.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to use here some of the SafeXXX
operations then to throw in case of overflow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, we don't currently have a Safe::multiply
. But I think it makes sense to replace this +=
with a Safe::add
, which will make this code safe. I'll add a follow-up commit.
Codecov Report
@@ Coverage Diff @@
## main #2424 +/- ##
=======================================
Coverage 64.54% 64.54%
=======================================
Files 119 119
Lines 21112 21114 +2
Branches 10420 10421 +1
=======================================
+ Hits 13626 13629 +3
Misses 5324 5324
+ Partials 2162 2161 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@kevinbackhouse looks like conan-io/conan-center-index#14259 caused the conan problem here. removing: Lines 36 to 37 in cf15cc5
should do the trick |
😱 ! I'll take a look to this issue |
Pull request has been modified.
When you rebase this branch on top of master, the failing CI jobs should turn green (Except for the cygwin one 🙈 ) |
530418d
to
9d044d3
Compare
Pull request has been modified.
Is this one ok to merge? |
Fixes: #2423
The most important change here is to add a
break
to the loop inQuickTimeVideo::sampleDesc
. The second important change is to make sure that all the private fields ofQuickTimeVideo
are initialized. I also did some cleanup of the types of some of the local variables.