Skip to content

Index every ProxyTrack cache entry under its full name - #2090

Merged
xroche merged 3 commits into
masterfrom
fz/B6
Nov 7, 2026
Merged

xroche merged 3 commits into
masterfrom
fz/B6

Conversation

@xroche

@xroche xroche commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

ProxyTrack now reads a cache zip with the same entry-name rule as the engine. It keeps names up to 4101 bytes whole and drops longer ones as a corrupted entry. Before, it indexed them under a name clipped at 4094 bytes, which minizip also left without a terminating NUL. The zip walk also strips http:// without regard to case.

The name buffer is now the engine's CACHE_ENTRYNAME_SIZE, which htscache.h defines outside its internal-only block so that ProxyTrack can use it. Without that size, the check would drop names of 4094 to 4101 bytes that the engine keeps.

Test 748 converts a crafted zip and fails on master, where it gets 5 index keys instead of 3. It also fails with the size check removed and with the case-sensitive http:// match put back.

xroche and others added 3 commits November 7, 2026 18:41
ProxyTrack's new.zip index walk passed no unz_file_info to minizip and
used a 4096-byte name buffer, so a longer entry name came back clipped
and unterminated, and indexed under a key that was not its name. Two
long names could then collapse onto one clipped key.

Use the engine's rule: a CACHE_ENTRYNAME_SIZE buffer, and reject a
name whose size_filename does not fit, as a corrupted entry. Match
http:// and X-In-Cache like the engine does, without regard to case,
in the zip walk and the ARC walk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
Move CACHE_KEY_SIZE and CACHE_ENTRYNAME_SIZE above the internal-only
block of htscache.h, so ProxyTrack uses the engine's constant instead of
a copied literal.

Put back the case-sensitive http:// match in the ARC walk. That walk
drops a record whose scheme fails PT_CompatibleScheme, which is
case-sensitive, so the change there had no effect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
The zip read path takes the absolute index position and parses
X-In-Cache again from the entry's own header, so the sign this match
sets is never read. Making it ignore case changed nothing a test could
see, so it does not belong in this PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche
xroche enabled auto-merge (squash) November 7, 2026 18:59
@xroche
xroche merged commit 1516ad6 into master Nov 7, 2026
39 checks passed
@xroche
xroche deleted the fz/B6 branch November 7, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant