{"record":{"id":"dcdb627c567bf3fa","repo":"vercel-labs/skills","slug":"invalid-zip64-locator","errorCode":null,"errorMessage":"Invalid zip64 locator","messagePattern":"Invalid zip64 locator","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/archive.ts","lineNumber":102,"sourceCode":"    totalEntries === 0xffff ||\n    size === 0xffffffff ||\n    offset === 0xffffffff;\n\n  if (!usesZip64) {\n    if (diskNumber !== 0 || centralDirectoryDisk !== 0 || entriesOnDisk !== totalEntries) {\n      throw new Error('Multi-disk zip archives are not supported');\n    }\n    return { entries: totalEntries, offset, size, trailerOffset: endOffset };\n  }\n\n  if (diskNumber !== 0 || centralDirectoryDisk !== 0) {\n    throw new Error('Multi-disk zip archives are not supported');\n  }\n\n  const locatorOffset = endOffset - 20;\n  ensureRange(buffer, locatorOffset, 20, 'zip64 locator');\n  if (buffer.readUInt32LE(locatorOffset) !== ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR) {\n    throw new Error('Invalid zip64 locator');\n  }\n  if (\n    buffer.readUInt32LE(locatorOffset + 4) !== 0 ||\n    buffer.readUInt32LE(locatorOffset + 16) !== 1\n  ) {\n    throw new Error('Multi-disk zip archives are not supported');\n  }\n\n  const zip64EndOffset = readUInt64AsNumber(buffer, locatorOffset + 8, 'zip64 end offset');\n  ensureRange(buffer, zip64EndOffset, 56, 'zip64 end of central directory');\n  if (buffer.readUInt32LE(zip64EndOffset) !== ZIP64_END_OF_CENTRAL_DIRECTORY) {\n    throw new Error('Invalid zip64 end of central directory');\n  }\n\n  const recordSize = readUInt64AsNumber(buffer, zip64EndOffset + 4, 'zip64 end size');\n  if (recordSize < 44) {\n    throw new Error('Invalid zip64 end of central directory');\n  }","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/vercel-labs/skills/blob/435076e78988e1e6ec40d00b0b1d76bdbbc5419a/src/archive.ts#L84-L120","documentation":"When zip64 sentinels are present, the parser reads a 20-byte zip64 end-of-central-directory locator immediately before the normal end record. If the signature at the start of that locator is not the expected ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR magic, the file is not a valid zip64 archive and this error is thrown. It typically means the file is corrupt, truncated, or the sentinel values were a coincidence of corruption.","triggerScenarios":"An end record with 0xffffffff offset/size sentinels but a missing, overwritten, or corrupt zip64 locator; appending data to a zip without rewriting trailers; fuzzed buffers where random bytes match the EOCD signature but the preceding 20 bytes are not a locator.","commonSituations":"Self-extracting executables or archives with prepended/appended data that break locator placement; partially overwritten files (disk corruption, concurrent writes); files processed by tools that write zip64 sentinels incorrectly.","solutions":["Verify with `unzip -t file.zip`; if it also fails, re-obtain the archive from the source.","Rebuild the archive: `zip -FF file.zip --out fixed.zip` can reconstruct central directories and locators.","If you create the archives, upgrade your zip-writing library (e.g. older yauzl/jszip/ adm-zip versions had zip64 bugs) to one with correct zip64 locator emission."],"exampleFix":"# before\nreadZipArchive(buffer); // throws 'Invalid zip64 locator'\n\n# after\n# repair the central directory / locator chain\nzip -FF broken.zip --out fixed.zip\nreadZipArchive(await fs.promises.readFile('fixed.zip'));","handlingStrategy":"try-catch","validationCode":"function hasValidZip64Locator(buffer: Buffer, eocd: number): boolean {\n  const loc = eocd - 20;\n  if (loc < 0) return false;\n  return buffer.readUInt32LE(loc) === 0x07064b50;\n}","typeGuard":"null","tryCatchPattern":"try {\n  const zip = readZipArchive(buffer);\n} catch (e) {\n  if ((e as Error).message === 'Invalid zip64 locator') {\n    // attempt repair via zip -FF, or reject\n  }\n  throw e;\n}","preventionTips":["Generate zips with a current, spec-compliant library.","Keep a repair step (zip -FF) in your ingestion pipeline for untrusted archives.","Verify checksums after transfer."],"tags":["zip","zip64","locator","corrupt-file","signature-mismatch"],"backgroundTag":"zip64-locator-invalid","analyzedSha":"435076e78988e1e6ec40d00b0b1d76bdbbc5419a","analyzedAt":"2026-08-28T17:47:53.369Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}