fix: refuse multi-md5 additions in RetroBat

This commit is contained in:
Abdessamad Derraz committed 2026-10-18 14:29:46 +02:00
1 parent 1e2f4e810b
commit 6458a927d4
4 files changed
+28 -8

No files matched your search

+9
View File
@@ -16,6 +16,10 @@ from .baseline import NativeFile, NativeSystem, Report
class BaseExporter(ABC):
"""Base class for writing a platform's own BIOS file, corrected."""
# A hash field the checker compares to one value: an addition the
# truth accepts under several cannot be written whole.
SINGLE_HASH_FIELD: str | None = None
@staticmethod
@abstractmethod
def platform_name() -> str:
@@ -145,6 +149,11 @@ class BaseExporter(ABC):
return True
if not cls.can_add() or (cls.keys_by_system() and fe.foreign_system):
return False
single = cls.SINGLE_HASH_FIELD
if single and len(set(fe.hashes(single))) > 1:
# One value checked: written with the first, the addition
# refuses every other dump the core accepts.
return False
require = require or cls.requires()
return not require or bool(fe.hash(require))