fix: freeze/__init__.py: NO_ADDRESS < NO_ADDRESS returns True

Closes #3025
This commit is contained in:
Willi Ballenthin
2026-04-22 09:47:14 +03:00
committed by Willi Ballenthin
parent c7d3de8bf8
commit f17629a4eb
3 changed files with 8 additions and 1 deletions

View File

@@ -36,6 +36,8 @@
- fix: base_extractor.py: __metaclass__ is Python 2 syntax, ignored in Py3 @williballenthin #3024
- fix: freeze/__init__.py: NO_ADDRESS < NO_ADDRESS returns True @williballenthin #3025
### capa Explorer Web
### capa Explorer IDA Pro plugin

View File

@@ -173,7 +173,7 @@ class Address(HashableModel):
return self.type < other.type
if self.type is AddressType.NO_ADDRESS:
return True
return False
else:
assert self.type == other.type

View File

@@ -165,6 +165,11 @@ def test_serialize_features():
roundtrip_feature(capa.features.insn.Property("System.IO.FileInfo::Length"))
def test_no_address_lt_irreflexivity():
no_addr = capa.features.freeze.Address.from_capa(capa.features.address.NO_ADDRESS)
assert not (no_addr < no_addr)
def test_freeze_sample(tmpdir, z9324d_extractor):
# tmpdir fixture handles cleanup
o = tmpdir.mkdir("capa").join("test.frz").strpath