-
Notifications
You must be signed in to change notification settings - Fork 282
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
Use readOrThrow to check error conditions of io.read() #1627
Use readOrThrow to check error conditions of io.read() #1627
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.
LGTM, Thanks!
@Mergifyio backport main |
Command
|
@kevinbackhouse how does this protect against read of uninitialized memory? I'm not intimately familiar with all of the inner workings of Exiv2, but looking at this, I see there is a length check of |
Hi @tcullum-rh, I think you are right in your analysis. I did not notice the |
@tcullum-rh: you are right, I misdiagnosed this. I just stepped through it in gdb and figured out what's going on. The poc is a 15 byte file, which is so short that it triggers an error in isCr2Type. Normally, these "is" functions ( So that's why the Even though I misunderstood the bug, I think my fix is still the right thing to do. |
It is safer to use
readOrThrow
, because it checks against the scenario where reading from the file fails.