LEARN. PRACTICE. EXPLAIN.
Learning paths & interview practiceP
← Reverse engineer a binary packfile
BUILD → VERIFY → EXPLAIN · STEP 2 OF 6

Decode section table and entry offsets

Parse the table of contents to map record names, data offsets, and payload lengths.

UNDERSTAND

Bring these concepts with you

BUILD

Your implementation

  1. Read each entry descriptor in the table of contents starting immediately at header offset 16.
  2. Each entry descriptor contains: 16-byte null-padded UTF-8 filename, 32-bit payload offset (LE), 32-bit uncompressed size (LE), and 32-bit CRC32 checksum.
  3. Store the mapped entries in an array of metadata objects and reject table overflows.
function parseTable(buffer, header) {
  // Loop through entryCount, reading name, offset, size, and crc32.
}
Need a hint?
  • Advance a cursor by descriptor size (28 bytes) for each entry up to entryCount.
  • Trim trailing null bytes from the filename string using str.replace(/\0+$/, '').

Saved on this device · 0 / 6000 · Do not include passwords or private data.

VERIFY

Acceptance checks

From the folder containing your downloaded files, run:

node checks.mjs ./starter.mjs 1 through 6 2

This runs checks up to this step. Earlier steps must work first. Mark each result only after checking your implementation; the website does not run or grade it.

Record your attempt to enable the checklist and reference comparison.

Compare with the reference

Attempt the step first, then compare decisions and behavior. There can be more than one correct implementation.

EXPLAIN

Your interviewer asks

How does checking offset + size <= buffer.length defend against integer overflow or malicious packfile exploits?

Say your answer aloud, then record the trade-offs and evidence in your notes above.

LOCAL VOICE REHEARSAL

Rehearse your step walkthrough aloud

Target pacing: 02:00 · Stays in this browser only; never uploaded.

00:00/ 02:00
AlifBay Prep