mirror of
https://github.com/xroche/httrack.git
synced 2026-07-23 09:09:05 +03:00
* Bound the cache-index (.ndx) parser to its buffer cache_brstr trusted the on-disk length prefix for its cursor advance (off += i, i up to 32768), so a corrupt or truncated hts-cache/*.ndx whose declared length overstates the file walked the length-prefixed scan past the end of the readfile() buffer; the next binput()/strchr() in the loader then read out of bounds. A cache truncated by a crash or a full disk, or one handed to --update/--continue, reaches it. Bound both the copy and the advance in cache_brstr to the bytes actually present (strnlen up to the terminating NUL), and add cache_binput(), a binput() that refuses to start a read at or past end-of-buffer, for the two loader scan loops in htscache.c and htscoremain.c; the latter also gains the a < end guard the former already had. Regression: -#test=cacheindex plus 01_engine-cacheindex.test (the deterministic bound check fails on the old advance; the ASan CI jobs also exercise the scan). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com> * gitignore: ignore dist/ release staging artifacts httrack-gh-release stages its signed tarballs in dist/ inside the checkout; only root-level /httrack-*.tar.gz was ignored, so a broad git add swept the 3.49.10/3.49.11 artifacts into this branch's first commit (since rewritten out). Ignore the directory. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com> --------- Signed-off-by: Xavier Roche <roche@httrack.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
11 lines
280 B
Bash
Executable File
11 lines
280 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
|
|
set -euo pipefail
|
|
|
|
# Cache-index (.ndx) parse must stay inside the buffer on a corrupt length
|
|
# prefix (ASan aborts here on the pre-fix binary; the OK check gates the
|
|
# non-sanitized build too).
|
|
|
|
test "$(httrack -O /dev/null -#test=cacheindex)" == 'cacheindex: OK'
|