# HG changeset patch
# User Cotizo Sima <cot...@fb.com>
# Date 1480079985 28800
#      Fri Nov 25 05:19:45 2016 -0800
# Node ID 4b311b730614941db6409f560ab9451bec74be75
# Parent  a3163433647108b7bec8fc45896db1c20b18ab21
revlog: ensure that flags do not overflow 2 bytes

This patch adds a line that ensures we are not setting by mistake a set of flags
overlfowing the 2 bytes they are allocated. Given the way the data is packed in
the revlog header, overflowing 2 bytes will result in setting a wrong offset.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -72,6 +72,7 @@
     return int(q & 0xFFFF)
 
 def offset_type(offset, type):
+    type &= 0xFFFF
     return long(long(offset) << 16 | type)
 
 _nullhash = hashlib.sha1(nullid)
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to