{"record":{"id":"6521fb01376b9335","repo":"can1357/oh-my-pi","slug":"invalid-lzh-unix-timestamp-extended-header","errorCode":null,"errorMessage":"Invalid LZH Unix timestamp extended header","messagePattern":"Invalid LZH Unix timestamp extended header","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/lzh.ts","lineNumber":390,"sourceCode":"\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x42:\n\t\t\tif (data.byteLength < 16) throw new ArchiveError(\"Invalid LZH 64-bit size extended header\");\n\t\t\tfields.packedSize = u64(data, 0);\n\t\t\tfields.size = u64(data, 8);\n\t\t\tbreak;\n\t\tcase 0x44:\n\t\t\tfields.unicodeFilename = decodeUtf16(data);\n\t\t\tbreak;\n\t\tcase 0x45:\n\t\t\tfields.unicodeDirectory = decodeUtf16(data).replaceAll(\"ÿ\", \"/\");\n\t\t\tbreak;\n\t\tcase 0x50:\n\t\t\tif (data.byteLength < 2) throw new ArchiveError(\"Invalid LZH Unix permissions extended header\");\n\t\t\tfields.mode = u16(data, 0);\n\t\t\tbreak;\n\t\tcase 0x54:\n\t\t\tif (data.byteLength < 4) throw new ArchiveError(\"Invalid LZH Unix timestamp extended header\");\n\t\t\tfields.mtimeMs = u32(data, 0) * 1000;\n\t\t\tbreak;\n\t}\n}\n\nclass LzhMemberSource implements MemberSource {\n\treadonly #archive: Uint8Array;\n\treadonly #start: number;\n\treadonly #packedSize: number;\n\treadonly #method: string;\n\treadonly #crc: number;\n\n\tconstructor(archive: Uint8Array, start: number, packedSize: number, method: string, crc: number) {\n\t\tthis.#archive = archive;\n\t\tthis.#start = start;\n\t\tthis.#packedSize = packedSize;\n\t\tthis.#method = method;\n\t\tthis.#crc = crc;","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/lzh.ts#L372-L408","documentation":"Extended header type 0x54 stores a Unix mtime as a u32 seconds value and must be at least 4 bytes long. A shorter data section is malformed, so the reader throws instead of producing a bogus timestamp.","triggerScenarios":"Reading an LZH member whose extended-header chain contains a type 0x54 entry with fewer than 4 data bytes — corrupt extension-size fields, truncation, or a non-conformant writer.","commonSituations":"Unix-origin .lzh archives with damaged headers; downloads cut short; archives processed by lossy metadata-editing tools.","solutions":["Re-transfer the archive — the extended-header chain is corrupt","Cross-check with an external extractor to locate the damaged member; repack the archive dropping bad headers","If you write LZH archives, emit type 0x54 headers with exactly 4 bytes (u32 LE epoch seconds) plus the 2-byte size trailer","Catch ArchiveError per member and continue processing other members where your API surface allows"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"null","tryCatchPattern":"try {\n\tconst entries = await readArchive(lzhBytes);\n} catch (err) {\n\tif (err instanceof ArchiveError && err.message.includes(\"Unix timestamp extended header\")) {\n\t\t// proceed without mtime or re-acquire the archive\n\t}\n\tthrow err;\n}","preventionTips":["Check archive integrity (checksum) after download","Use standard archivers to produce Unix-time extended headers","Avoid post-hoc byte edits of header chains"],"tags":["archive","lzh","corrupt-header","timestamp"],"backgroundTag":"corrupt-archive-header","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}