mirror of
https://github.com/xroche/httrack.git
synced 2026-07-15 21:30:29 +03:00
Compare commits
2 Commits
master
...
fix/fuzz-f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cbdd58260 | ||
|
|
031d4a498f |
@@ -39,6 +39,7 @@ EXTRA_DIST = README.md run-fuzzers.sh \
|
||||
corpus/filters/filter.bin corpus/filters/filter-size.bin \
|
||||
corpus/filters/regress-empty-subject-unique.bin \
|
||||
corpus/filters/redos-star-classes.bin \
|
||||
corpus/filters/regress-classdepth-timeout.bin \
|
||||
corpus/url/http-url.txt corpus/url/relative-path.txt \
|
||||
corpus/url/regress-file-empty-path.txt corpus/url/regress-long-path-abort.txt \
|
||||
corpus/header/full-response.txt corpus/header/redirect.txt \
|
||||
|
||||
BIN
fuzz/corpus/filters/regress-classdepth-timeout.bin
Normal file
BIN
fuzz/corpus/filters/regress-classdepth-timeout.bin
Normal file
Binary file not shown.
@@ -154,12 +154,14 @@ static const char *strjoker_rec(strjoker_memo *memo, const char *chaine,
|
||||
|
||||
if (depth > memo->maxdepth)
|
||||
memo->maxdepth = depth;
|
||||
/* Charge the budget before the depth cap: cut disables the memo, so uncounted
|
||||
deep calls would let the sub-cap search explode (OSS-Fuzz 535114376). */
|
||||
if (memo->nsteps != NULL && ++*memo->nsteps > STRJOKER_MAXSTEPS)
|
||||
return NULL; /* work budget spent: fail the match safely */
|
||||
if (depth >= STRJOKER_MAXDEPTH) {
|
||||
memo->cut = HTS_TRUE;
|
||||
return NULL; /* nesting beyond any real filter: fail the branch safely */
|
||||
}
|
||||
if (memo->nsteps != NULL && ++*memo->nsteps > STRJOKER_MAXSTEPS)
|
||||
return NULL; /* work budget spent: fail the match safely */
|
||||
if (memo->failed) {
|
||||
bit = (size_t) (chaine - memo->chaine0) * memo->stride +
|
||||
(size_t) (joker - memo->joker0);
|
||||
|
||||
@@ -794,6 +794,20 @@ static int st_filterbounds(httrackp *opt, int argc, char **argv) {
|
||||
memset(subj, 'a', 32);
|
||||
subj[32] = '\0';
|
||||
assertf(strjoker(subj, pat, NULL, NULL) != NULL);
|
||||
/* Same pin for the class-branch shape users actually write (*[..]), against a
|
||||
long subject: it must match with room to spare under the work cap. */
|
||||
{
|
||||
const char *seg = "*[A-Z,a-z,0-9]";
|
||||
const size_t seglen = strlen(seg), nseg = 16;
|
||||
|
||||
for (i = 0; i < (int) nseg; i++)
|
||||
memcpy(pat + i * seglen, seg, seglen);
|
||||
pat[nseg * seglen] = '\0';
|
||||
memset(subj, 'a', 512);
|
||||
subj[512] = '\0';
|
||||
assertf(strjoker_bounds(subj, pat, &steps, &maxsteps, NULL, NULL) != NULL);
|
||||
assertf(steps < maxsteps);
|
||||
}
|
||||
freet(pat);
|
||||
freet(subj);
|
||||
printf("filterbounds: OK\n");
|
||||
|
||||
Reference in New Issue
Block a user