Mercurial > hg
comparison mercurial/dirstatemap.py @ 47675:48aec076b8fb
dirstate-v2: Enforce data size read from the docket file
The data file may not be shorter than its size given by the docket.
It may be longer, but additional data is ignored.
Differential Revision: https://phab.mercurial-scm.org/D11089
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 12 Jul 2021 22:46:52 +0200 |
parents | ff97e793ed36 |
children | 065e61628980 |
comparison
equal
deleted
inserted
replaced
47674:ff97e793ed36 | 47675:48aec076b8fb |
---|---|
635 if self.docket.uuid: | 635 if self.docket.uuid: |
636 # TODO: use mmap when possible | 636 # TODO: use mmap when possible |
637 data = self._opener.read(self.docket.data_filename()) | 637 data = self._opener.read(self.docket.data_filename()) |
638 else: | 638 else: |
639 data = b'' | 639 data = b'' |
640 self._rustmap = rustmod.DirstateMap.new_v2(data) | 640 self._rustmap = rustmod.DirstateMap.new_v2( |
641 data, self.docket.data_size | |
642 ) | |
641 parents = self.docket.parents | 643 parents = self.docket.parents |
642 else: | 644 else: |
643 self._rustmap, parents = rustmod.DirstateMap.new_v1( | 645 self._rustmap, parents = rustmod.DirstateMap.new_v1( |
644 self._use_dirstate_tree, self._readdirstatefile() | 646 self._use_dirstate_tree, self._readdirstatefile() |
645 ) | 647 ) |