Skip to content
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 infinite loop in Image::printIFDStructure #1778

Merged

Conversation

kevinbackhouse
Copy link
Collaborator

Fixes GHSA-m479-7frc-gqqg

The problem is that this loop can be infinite when dirLength is zero. If dirLength > 0 then the loop cannot be infinite because the algorithm uses a set named visits to make sure that the same location is never visited twice. I am not an expert on this format, but it seems unlikely to me that dirLength == 0 is ever valid, so disallowing that is a simple way to fix the bug.

The second commit fixes the bug.

I didn't like the look of some of the parsing code in this function, so I added a third commit which adds more error checking.

@kevinbackhouse kevinbackhouse added this to the v0.27.5 milestone Jul 13, 2021
@kevinbackhouse kevinbackhouse added the forward-to-main Forward changes in a 0.28.x PR to main with Mergify label Jul 13, 2021
@lgtm-com
Copy link

lgtm-com bot commented Jul 13, 2021

This pull request introduces 1 alert and fixes 1 when merging d9fd4c4 into 4af6e40 - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

fixed alerts:

  • 1 for Multiplication result converted to larger type

@hassec hassec added the bug label Jul 15, 2021
@kevinbackhouse kevinbackhouse merged commit 1c919da into Exiv2:0.27-maintenance Jul 15, 2021
kevinbackhouse added a commit that referenced this pull request Jul 16, 2021
Fix infinite loop in Image::printIFDStructure (backport #1778)
@kevinbackhouse kevinbackhouse deleted the Fix-GHSA-m479-7frc-gqqg branch July 26, 2021 11:57
@clanmills clanmills mentioned this pull request Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug forward-to-main Forward changes in a 0.28.x PR to main with Mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants