From 6fc59fdbae91cd4a4376c2aa96b062716e75e4fa Mon Sep 17 00:00:00 2001 From: oranges Date: Thu, 3 Aug 2023 01:41:07 +1200 Subject: [PATCH] Fix bounds check for map bogus keys in maptools (#77283) Prevents rare cases of map merge eating your map --- tools/mapmerge2/dmm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mapmerge2/dmm.py b/tools/mapmerge2/dmm.py index 5702ed21edc..bc12a39b355 100644 --- a/tools/mapmerge2/dmm.py +++ b/tools/mapmerge2/dmm.py @@ -95,7 +95,7 @@ class DMM: # last-second handling of bogus keys to help prevent and fix broken maps self._ensure_free_keys(0) max_key = max_key_for(self.key_length) - bad_keys = {key: 0 for key in self.dictionary.keys() if key > max_key} + bad_keys = {key: 0 for key in self.dictionary.keys() if key >= max_key} if bad_keys: print(f"Warning: fixing {len(bad_keys)} overflowing keys") for k in bad_keys: