prestodb/presto · error · IllegalArgumentException

invalid local header offset

Error message

invalid local header offset

What it means

Sanity check in the ZIP entry writer: setLocalHeaderOffset was given a negative offset, which cannot point at any local file header in the archive. Reached when reading entries (read path), it signals corrupt or maliciously crafted offset data in the ZIP structure.

Source

Thrown at presto-druid/src/main/java/com/facebook/presto/druid/zip/ZipFileEntry.java:326

    }

    /**
     * Sets the external file attributes of the entry.
     */
    public void setExternalAttributes(int externalAttributes)
    {
        this.externalAttributes = externalAttributes;
    }

    public int getExternalAttributes()
    {
        return externalAttributes;
    }

    void setLocalHeaderOffset(long localHeaderOffset)
    {
        if (localHeaderOffset < 0) {
            throw new IllegalArgumentException("invalid local header offset");
        }
        if (localHeaderOffset > 0xffffffffL) {
            featureSet.add(Feature.ZIP64_OFFSET);
        }
        else {
            featureSet.remove(Feature.ZIP64_OFFSET);
        }
        this.localHeaderOffset = localHeaderOffset;
    }

    public long getLocalHeaderOffset()
    {
        return localHeaderOffset;
    }

    public void setExtra(ExtraDataList extra)
    {
        checkArgument(extra != null, "Zip file data could not be null");

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Fix the producer writing the entry offsets
  2. Validate archive integrity (offsets within file bounds) before writing
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-druid/src/main/java/com/facebook/presto/druid/zip/ZipFileEntry.java:326 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/c802e0e7d5a3e39e. Report an issue: GitHub.