Remove GIT_PKT_PACK entirely#4704
Merged
Merged
Conversation
Member
|
This seems reasonable to me, but getting 👀 on it by @carlosmn would be nice. |
ethomson
reviewed
Jun 27, 2018
| } | ||
|
|
||
| return (int)len; | ||
| return GIT_ERROR; |
Member
There was a problem hiding this comment.
We should set an error message here, perhaps:
giterr_set(GITERR_NET, "unexpected pack file");
return -1;
(We usually do return -1 instead of return GIT_ERROR out of convention. I'd like to keep that moving forward.)
Member
|
Looks good to me. @ethomson, any further comments on this? |
carlosmn
approved these changes
Jul 15, 2018
Member
carlosmn
left a comment
There was a problem hiding this comment.
Looks fine other than the place-holder value.
| GIT_PKT_ACK, | ||
| GIT_PKT_NAK, | ||
| GIT_PKT_PACK, | ||
| GIT_PKT_PACK__UNUSED, |
Member
There was a problem hiding this comment.
This is a private struct, we don't need place-holders for deleted values.
Contributor
Author
|
@carlosmn Thanks, removed the placeholder. |
Member
|
Thanks @nelhage! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a heavier-handed alternative to #4694
git_pkt_pack/GIT_PKT_PACKare, as best I can tell, never used by any client of the pack APIs. Futhermore, they are incredibly dangerous; Because https://github.com/libgit2/libgit2/blob/master/src/transports/smart_pkt.c#L419-L423 does not advanceout, any client is required to check forGIT_PKT_PACKand bail out, or else go into an infinite loop callinggit_pkt_parse_lineto get a new packet, which will from that point forward always return aGIT_PKT_PACK.My fuzzer has found at least two callers that can be forced into an infinite loop via a misplaced
PACK, and I suspect there are more.