diff rust/hg-core/src/revlog/index.rs @ 48210:61ce70fd420e

rhg: handle null changelog and manifest revisions Differential Revision: https://phab.mercurial-scm.org/D11650
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Tue, 12 Oct 2021 19:43:51 +0100
parents 001d747c2baf
children 5e77bdc29d56
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/index.rs	Tue Oct 12 15:43:45 2021 +0200
+++ b/rust/hg-core/src/revlog/index.rs	Tue Oct 12 19:43:51 2021 +0100
@@ -208,6 +208,9 @@
 
 /// Value of the inline flag.
 pub fn is_inline(index_bytes: &[u8]) -> bool {
+    if index_bytes.len() < 4 {
+        return true;
+    }
     match &index_bytes[0..=1] {
         [0, 0] | [0, 2] => false,
         _ => true,