FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0108 — A licence file cut by more than the writer's header padding loses its last entry without an error
ID 0108
Class KNOWN-LIMITATION
Severity 2
Status blocked

Models: —

Decision needed: may a licence file be refused when its size is not 2*kHeaderBytes + n*kLineLength? Older files may not follow that rule.

Found: 2026-10-25 plan r2-licence, new observation (follow-up of R3-12)

Evidence

src/engine/license/LicenseManager.cpp numLines = fileSize / kLineLength (about :430): the number of entries comes from the file size, not from a stored count. The writer writes kHeaderBytes unsigned shorts (116 bytes) before the entries (LicenseWriter.cpp), so a valid file is 116 + n*690 bytes. A file cut by 117 bytes or more, up to one whole entry, reads as n-1 entries, with no error. A cut of 59 to 116 bytes damages the last entry and is now refused (R3-12).

Effect

A truncated licence (a bad copy, a full disk) quietly grants fewer licences than were issued. Nothing says the file is damaged; an unlimited licence hides the missing entry.

Possible fix

A size rule (size == 2*kHeaderBytes + n*kLineLength) would refuse such a file, but older licence files may not follow it. Owner decision needed on how old files are written, or a stored entry count in the header.

Test that would prove it

A file with two entries cut by 400 bytes: expect an error naming the file.

Risk

Medium: a size rule can refuse licences already issued.