diff options
author | Jeff King <peff@peff.net> | 2013-02-20 14:54:57 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-02-20 13:42:21 -0800 |
commit | e58e57e49eb990e38df19628a744c71b44397ef1 (patch) | |
tree | 0bd61d02b2f4c97487002f97e9d90b24c3038e23 /t | |
parent | b7b021701cea6c9e54c826e1f6bc5faa9d3fef53 (diff) | |
download | git-e58e57e49eb990e38df19628a744c71b44397ef1.tar.gz |
upload-pack: do not add duplicate objects to shallow list
When the client tells us it has a shallow object via
"shallow <sha1>", we make sure we have the object, mark it
with a flag, then add it to a dynamic array of shallow
objects. This means that a client can get us to allocate
arbitrary amounts of memory just by flooding us with shallow
lines (whether they have the objects or not). You can
demonstrate it easily with:
yes '0035shallow e83c5163316f89bfbde7d9ab23ca2e25604af290' |
git-upload-pack git.git
We already protect against duplicates in want lines by
checking if our flag is already set; let's do the same thing
here. Note that a client can still get us to allocate some
amount of memory by marking every object in the repo as
"shallow" (or "want"). But this at least bounds it with the
number of objects in the repository, which is not under the
control of an upload-pack client.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
0 files changed, 0 insertions, 0 deletions