##// END OF EJS Templates
revlog: raise an exception earlier if an entry is too large (issue4675)...
Jordi Gutiérrez Hermoso -
r25410:eee88912 default
parent child Browse files
Show More
@@ -153,6 +153,10 b' indexformatng = ">Qiiiiii20s12x"'
153 ngshaoffset = 32
153 ngshaoffset = 32
154 versionformat = ">I"
154 versionformat = ">I"
155
155
156 # corresponds to uncompressed length of indexformatng (2 gigs, 4-byte
157 # signed integer)
158 _maxentrysize = 0x7fffffff
159
156 class revlogio(object):
160 class revlogio(object):
157 def __init__(self):
161 def __init__(self):
158 self.size = struct.calcsize(indexformatng)
162 self.size = struct.calcsize(indexformatng)
@@ -163,6 +167,12 b' class revlogio(object):'
163 return index, getattr(index, 'nodemap', None), cache
167 return index, getattr(index, 'nodemap', None), cache
164
168
165 def packentry(self, entry, node, version, rev):
169 def packentry(self, entry, node, version, rev):
170 uncompressedlength = entry[2]
171 if uncompressedlength > _maxentrysize:
172 raise RevlogError(
173 _("size of %d bytes exceeds maximum revlog storage of 2GiB")
174 % uncompressedlength)
175
166 p = _pack(indexformatng, *entry)
176 p = _pack(indexformatng, *entry)
167 if rev == 0:
177 if rev == 0:
168 p = _pack(versionformat, version) + p[4:]
178 p = _pack(versionformat, version) + p[4:]
General Comments 0
You need to be logged in to leave comments. Login now