Skip to content

fuzz: Apply HasTooManySubFrag (et al) to miniscript_string (et al) #30498

Closed

Description

@maflcko

Should the check be applied to miniscript_string, for example the miniscript_string/ae395bdc087e233d7f8e1844d4814b2c00cc9d21 input, as well?

Originally posted by @maflcko in #30197 (comment)

Seems useful to at least apply to that fuzz target as well. In theory it could be applied to parse_univalue as well (reverting commit a1b8a91).

Activity

  1. darosior commented on Jul 27, 2024

    @darosior
    Member

    I said it makes sense, but giving this a closer look i don't think it's needed. And it's the reason why it wasn't hit by this target before. HasDeepDerivPath does not apply as we do not parse derivation paths in this target. HasTooManySubFrag is not needed as this target does not call any function which involves quadratic algorithms over the number of sub fragments. Similarly, HasTooManyWrappers isn't needed because we do not call ToScript() on the parsed miniscript.

  2. maflcko commented on Jul 29, 2024

    @maflcko
    MemberAuthor

    Ok, then maybe another limit could be appropriate, because I am not sure if a 120KB string is a real-world use case. (No objection to fuzzing it, but is seems to be taking a long time, which will hurt fuzzing of other inputs in the same target).

    ───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────
           │ File: ./miniscript_string/ae395bdc087e233d7f8e1844d4814b2c00cc9d21
    ───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       1   │ v:and_b(and_b(and_b(and_b(and_b(and_b(and_b(and_b(and_b(and_b(and_b(and_b(and_b(and_b(and_b(and_b(and_b(and_b(a
           │ nd_b(and_b(older(7403566),a:0),a:0),t:or_d(u:thresh(3,u:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:
           │ 1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1
           │ ,au:1,au:1,au:1,auau:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:1,au:
           │ 1,au:1,au:1,au:1,aullllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
    

    https://cirrus-ci.com/task/6370113769701376?logs=ci#L4545:

    Run miniscript_string with args ['/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/fuzz', '-runs=1', PosixPath('/ci_container_base/ci/scratch/qa-assets/fuzz_seed_corpus/miniscript_string')]INFO: Running with entropic power schedule (0xFF, 100).
    INFO: Seed: 1619189122
    INFO: Loaded 1 modules   (616236 inline 8-bit counters): 616236 [0x56001e233918, 0x56001e2ca044), 
    INFO: Loaded 1 PC tables (616236 PCs): 616236 [0x56001e2ca048,0x56001ec31308), 
    INFO:     1234 files found in /ci_container_base/ci/scratch/qa-assets/fuzz_seed_corpus/miniscript_string
    INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 262199 bytes
    INFO: seed corpus: files: 1234 min: 1b max: 262199b total: 3963484b rss: 112Mb
    #1024	pulse  cov: 3454 ft: 24651 corp: 751/204Kb exec/s: 256 rss: 292Mb
    Slowest unit: 19 s:
    artifact_prefix='./'; Test unit written to ./slow-unit-ae395bdc087e233d7f8e1844d4814b2c00cc9d21
    #1235	INITED cov: 3454 ft: 25292 corp: 832/851Kb exec/s: 13 rss: 942Mb
    #1235	DONE   cov: 3454 ft: 25292 corp: 832/851Kb lim: 130419 exec/s: 13 rss: 942Mb
    Done 1235 runs in 92 second(s)
    
    $ FUZZ=miniscript_string perf record -g --call-graph dwarf  ./src/test/fuzz/fuzz ./miniscript_string/ae395bdc087e233d7f8e1844d4814b2c00cc9d21 
    $ hotspot ./perf.data
    

    Screenshot from 2024-07-29 09-36-00

  3. added a commit that references this issue on Feb 7, 2025
  4. maflcko commented on Jan 14, 2026

    @maflcko
    MemberAuthor

    Looks like the ae395bdc087e233d7f8e1844d4814b2c00cc9d21 input was nuked from git history in the meantime. The current reproducer is:

    curl -fLO 'https://raw.githubusercontent.com/bitcoin-core/qa-assets/eac1c57614d7823bcd6079814749f72018aea438/fuzz_corpora/miniscript_string/41bae50cffd1741150a1b330d02ab09f46ff8cd1'
    FUZZ=miniscript_string perf record -g --call-graph fp  ./bld-cmake/bin/fuzz ./41bae50cffd1741150a1b330d02ab09f46ff8cd1
    hotspot ./perf.data
    
  5. maflcko commented on Jan 14, 2026

    @maflcko
    MemberAuthor

    Fix in #34288

  6. added a commit that references this issue on Jan 15, 2026
  7. added 2 commits that reference this issue on Jun 28, 2026
  8. added 2 commits that reference this issue on Jun 30, 2026
  9. added 2 commits that reference this issue on Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions