Patchwork D7892: nodemap: never read more than the expected data amount

login
register
mail settings
Submitter phabricator
Date Feb. 11, 2020, 1:28 a.m.
Message ID <cdac361fc98705d0f51c77da72c8ed60@localhost.localdomain>
Download mbox | patch
Permalink /patch/45144/
State Not Applicable
Headers show

Comments

phabricator - Feb. 11, 2020, 1:28 a.m.
Closed by commit rHGc7eebdb15139: nodemap: never read more than the expected data amount (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7892?vs=19904&id=20125

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7892/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7892

AFFECTED FILES
  mercurial/revlogutils/nodemap.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py
--- a/mercurial/revlogutils/nodemap.py
+++ b/mercurial/revlogutils/nodemap.py
@@ -45,7 +45,12 @@ 
     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):