BigPizzaV3/CodexPlusPlus · error

Dream Skin 主题包解包后超过 64 MiB 限制

Error message

Dream Skin 主题包解包后超过 64 MiB 限制

What it means

The running total of decompressed entry sizes is tracked in `unpacked`; if it exceeds UNPACKED_LIMIT (64 MiB), the package is rejected. This is a zip-bomb defense bounding total extracted bytes even if the compressed archive is small.

Solutions

  1. Reduce total uncompressed asset size below 64 MiB (compress images, remove files)
  2. Treat the error as a possible zip bomb if the compressed package is tiny — reject the source
  3. Audit the package contents (`unzip -l`) to see total uncompressed size before repackaging
  4. Split assets across packages if genuinely needed

Example fix

// before
unzip -l theme.zip  # 80 MiB uncompressed
// after
optipng background.png && remove extra assets  # < 64 MiB total
Defensive patterns

Strategy: validation

Validate before calling

let total: usize = entry_sizes.iter().sum();
const UNPACKED_LIMIT: usize = 64 * 1024 * 1024;
if total > UNPACKED_LIMIT {
    return Err(UnpackedTooLarge(total));
}

Try / catch

match validate_and_read_package(&bytes, platform) {
    Err(e) if e.to_string().contains("64 MiB") => {
        Err(UserFacingError::SuspiciousOrOversizedPackage)
    }
    other => other,
}

Prevention

When it happens

Trigger: A package whose entries' combined decompressed sizes exceed 64 MiB — notably a zip bomb (highly compressed large files) — processed by validate_and_read_package.

Common situations: Malicious zip bomb submitted to the market; legitimate theme with many large assets that individually pass per-file limits but total over 64 MiB.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/db103f8e8d0c19bd. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin_package.rs:133

        let base_name = name.rsplit('/').next().unwrap_or_default();
        if base_name == ".DS_Store" || name.starts_with("__MACOSX/") {
            entries.push((name, None));
            continue;
        }
        if !ALLOWED_FILES.contains(&base_name) {
            bail!("主题包包含不支持的文件:{name}");
        }
        let limit = file_limit(base_name);
        let mut content = Vec::new();
        file.take((limit + 1) as u64)
            .read_to_end(&mut content)
            .context("读取 Dream Skin ZIP 内容失败")?;
        if content.is_empty() || content.len() > limit {
            bail!("主题包文件 {name} 超过大小限制");
        }
        unpacked = unpacked.saturating_add(content.len());
        if unpacked > UNPACKED_LIMIT {
            bail!("Dream Skin 主题包解包后超过 64 MiB 限制");
        }
        entries.push((name, Some(content)));
    }

    let mut files = normalize_package_entries(entries)?;

    let manifest_bytes = files
        .remove("manifest.json")
        .context("主题包缺少 manifest.json")?;
    let theme_bytes = files
        .remove("theme.json")
        .context("主题包缺少 theme.json")?;
    let css_bytes = files.remove("theme.css").context("主题包缺少 theme.css")?;
    let image_name = ["background.webp", "background.jpg", "background.png"]
        .iter()
        .find(|name| files.contains_key(**name))
        .map(|name| (*name).to_string())
        .context("主题包必须包含一个背景图片")?;

View on GitHub (pinned to b1ed92e5e4)