Commit c7eebdb1513 by Pierre-Yves David

nodemap: never read more than the expected data amount

Since we are tracking this number we can use it to detect corrupted rawdata file
and to only read the correct amount of data when possible.

Differential Revision: https://phab.mercurial-scm.org/D7892
parent 2ea6a67ff50
......@@ -45,7 +45,12 @@ def persisted_data(revlog):
docket.data_unused = data_unused
filename = _rawdata_filepath(revlog, docket)
return docket, revlog.opener.tryread(filename)
data = revlog.opener.tryread(filename)
if len(data) < data_length:
return None
elif len(data) > data_length:
data = data[:data_length]
return docket, data
def setup_persistent_nodemap(tr, revlog):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment