From 05f60ae753440c0cc2d952ffb98d402f4fffafc3 Mon Sep 17 00:00:00 2001 From: angie Date: Sun, 17 Nov 2024 14:47:04 -0300 Subject: [PATCH] Error on zero-sized bins --- src/splat/segtypes/common/bin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/splat/segtypes/common/bin.py b/src/splat/segtypes/common/bin.py index 8c7b2aef..cb4da05b 100644 --- a/src/splat/segtypes/common/bin.py +++ b/src/splat/segtypes/common/bin.py @@ -24,6 +24,9 @@ def split(self, rom_bytes): f"segment {self.name} needs to know where it ends; add a position marker [0xDEADBEEF] after it" ) + if self.size is None or self.size <= 0: + log.error(f"Segment {self.name} has zero size.") + with open(path, "wb") as f: assert isinstance(self.rom_start, int) assert isinstance(self.rom_end, int)