Patchwork D8370: manifest: fix another pure-parsing 20-byte assumption

login
register
mail settings
Submitter phabricator
Date April 2, 2020, 8:32 p.m.
Message ID <differential-rev-PHID-DREV-l7j7p6thomebzcnpnjir-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46003/
State Superseded
Headers show

Comments

phabricator - April 2, 2020, 8:32 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/manifest.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - April 14, 2020, 8:51 a.m.
Alphare added a comment.
Alphare accepted this revision.


  Same here (and for every other point in the stack, I won't spam comments).

REPOSITORY
  rHG Mercurial

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

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

To: durin42, #hg-reviewers, Alphare
Cc: Alphare, mercurial-devel

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -377,8 +377,11 @@ 
                     t = self.extradata[-cur - 1]
                     l.append(self._pack(t))
                     self.positions[i] = offset
-                    if len(t[1]) > 20:
-                        self.extrainfo[i] = ord(t[1][21])
+                    hlen = 20
+                    if len(t[1]) > 25:
+                        hlen = 32
+                    if len(t[1]) > hlen:
+                        self.extrainfo[i] = ord(t[1][hlen + 1])
                     offset += len(l[-1])
                     i += 1
         self.data = b''.join(l)