-
Notifications
You must be signed in to change notification settings - Fork 778
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
xar: Avoid infinite link loop #2123
Conversation
A file may have only one link target at a time. Otherwise the internal link structure could loop. Besides, a hard link realistically can only link to one file, not multiple ones. Consider such an archive invalid.
Thanks! The fix looks reasonable to me, but I'd like to include a test as well. Can you explain how to re-create your test archive? |
I have created the archive by patching libarchive to create invalid xar files due to duplicate link entries:
With such a modified
|
A file may have only one link target at a time. Otherwise the internal link structure could loop. Besides, a hard link realistically can only link to one file, not multiple ones. Consider such an archive invalid. Co-authored-by: Martin Matuska <martin@matuska.de>
A file may have only one link target at a time. Otherwise the internal link structure could loop. Besides, a hard link realistically can only link to one file, not multiple ones. Consider such an archive invalid. Co-authored-by: Martin Matuska <martin@matuska.de>
A file may have only one link target at a time. Otherwise the internal link structure could loop. Besides, a hard link realistically can only link to one file, not multiple ones. Consider such an archive invalid. Co-authored-by: Martin Matuska <martin@matuska.de>
A file may have only one link target at a time. Otherwise the internal link structure could loop. Besides, a hard link realistically can only link to one file, not multiple ones. Consider such an archive invalid. Co-authored-by: Martin Matuska <martin@matuska.de>
Merged |
A file may have only one link target at a time. Otherwise the internal link structure could loop. Besides, a hard link realistically can only link to one file, not multiple ones.
Consider such an archive invalid.
Proof of Concept:
An infinite loop is entered with 100 % CPU usage which will never complete (and neither fail due to memory constraints etc.).