diff options
author | Andy Doan <andy.doan@linaro.org> | 2016-04-06 10:28:24 -0500 |
---|---|---|
committer | Andy Doan <andy.doan@linaro.org> | 2016-04-06 10:28:24 -0500 |
commit | 4541f54919c1e242af2fb7018b76f0ddb955afe4 (patch) | |
tree | 1d186d6ea709041138a08243455fd31b4c9aaebf /gitrepo.py | |
parent | 36bf774bfadf0822491a841d8f0b396ed0bde8ed (diff) |
discard giant patches
We occasionally see giant patches come in, normally from libvirt
releases such as:
http://libvirt.org/git/?p=libvirt.git;a=commit;h=0086221cb377c7a1c2df58b8ee5eb8223f989765
Patchwork looks at patches line by line, and this consumes tons of
memory and runs for hours blocking everything. This detects giant
patches and safely discards them.
Change-Id: I2403941c708c0923bbe143e783f5869da88f880d
Diffstat (limited to 'gitrepo.py')
-rw-r--r-- | gitrepo.py | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -128,4 +128,7 @@ class Repo(object): # the patchwork parser code operates character by character so we must # convert to unicode so it can be handled properly patch = patch.decode('utf-8', errors='replace') + # Don't try and process >5Mb patches, they flood the server + if len(patch) > 5000000: + raise MemoryError('patch too large to process: %d' % len(patch)) return parse_patch(patch)[0] |