From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:NPDM" |
|---|
| claim | "Atmosphere's loader reads main.npdm (at most 0x8000 bytes, at least 0x80) and checks: META magic, a flags0 mask test that cannot fail as written (see the condition), ACID and ACI0 extents inside the file after the 0x80 header, ACID magic and production flag, ACI0 magic, and that the FAC/SAC/KAC (FAH/SAC/KAC for ACI0) regions lie inside their blocks." |
|---|
| scope | | level | "tool" |
|---|
| applies_to | "Atmosphere stratosphere loader" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "loading main.npdm of a program (LoadMetaFromFile, ValidateNpdm, ValidateAcid, ValidateAci)" |
|---|
| effect | "ldr::ResultInvalidMeta (ResultMetaOverflow if larger than 0x8000)" |
|---|
| condition | "Npdm: magic == META; !(npdm->flags0 & 0x80000000) where flags0 is a u8 member, so by C integer promotion the test is always true (Unverified: not compiled or run); acid_offset/acid_size inside [0x80, file size] with size >= sizeof(Acid)=0x240; aci likewise with size >= 0x40. Acid: magic ACID; Acid::AcidFlag_Production set unless the development override is on; version and unknown_209 must both be 0 when unknown_209 is below the supported SDK major version; fac/sac/kac subregions inside the ACID block. Aci: magic ACI0; fah/sac/kac subregions inside the ACI0 block. From firmware 10.0.0 an RSA-2048 PSS signature of the ACID over (modulus .. size) is also verified (a separate function, ValidateAcidSignature). Not read: how the meta is later patched." |
|---|
| function | "ValidateNpdm" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "ValidateSubregion, ValidateNpdm, ValidateAcid, ValidateAci, size checks in LoadMetaFromFile" |
|---|
| repo | "Atmosphere-NX/Atmosphere" |
|---|
| commit | "6b0c077b4c608a3a2ee712b8dc35fee87ceb62e8" |
|---|
| path | "stratosphere/loader/source/ldr_meta.cpp" |
|---|
| lines | "27, 78-137, 147-171, 174-221" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Atmosphere NPDM validation" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T12:50:38.607Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T13:17:07.990Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read ldr_meta.cpp 20-230 at 6b0c077 and the Npdm/Acid/Aci definitions in libstratosphere ldr_types.hpp at the same commit: flags0 is u8 so '!(flags0 & 0x80000000)' is always true; sizeof Npdm 0x80, Acid 0x240, Aci 0x40; ResultMetaOverflow above 0x8000; ValidateAcidSignature separate and only from 10.0.0. Matches." |
|---|
|
|
|---|