From 941b54c3f89536e099fb07c75f83d450804e5dae Mon Sep 17 00:00:00 2001 From: yuanzonghao Date: Thu, 18 Jun 2026 21:56:38 +0800 Subject: [PATCH] fix(share): require at least 1 byte of content in .infiplot files Reject header-only files (37 bytes, empty plaintext) at the unpack boundary instead of letting them through as empty strings. Co-Authored-By: Claude Opus 4.6 --- lib/galleryCrypto.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galleryCrypto.ts b/lib/galleryCrypto.ts index cf650d6..c1e63b0 100644 --- a/lib/galleryCrypto.ts +++ b/lib/galleryCrypto.ts @@ -28,7 +28,7 @@ export async function packDoc(docStr: string): Promise { } export async function unpackDoc(blob: Uint8Array): Promise { - if (blob.length < HEADER_LEN) { + if (blob.length < HEADER_LEN + 1) { throw new Error("文件太小,不是合法的分享文件"); } for (let i = 0; i < MAGIC.length; i++) {