GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — mcpx(settings): byte sizes accept negatives and int64 overflow — http.streamBufferInit=-1 passes validation, then panics the CLI with 'makeslice: cap out of range' at the first streaming read · Issue #1697 · developing-today/code

mcpx(settings): byte sizes accept negatives and int64 overflow — http.streamBufferInit=-1 passes validation, then panics the CLI with 'makeslice: cap out of range' at the first streaming read #1697

New issue
Copy link
New issue
Copy link
Closed
Closed
mcpx(settings): byte sizes accept negatives and int64 overflow — http.streamBufferInit=-1 passes validation, then panics the CLI with 'makeslice: cap out of range' at the first streaming read#1697
Copy link
Assignees
dezren39
Labels
app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Description

@dezren39
dezren39
opened on Oct 28, 2026
Issue body actions

Summary

Byte-size settings (KindBytes) accept negative and overflowing values: settings.ParseBytes returns them with no error, Validate/Normalize pass them through, and at least one consumer spends the value as a slice capacity with no guard — so a config file, env var, or runtime override that sets http.streamBufferInit to -1 (or to a size so large it overflows int64) crashes the CLI with makeslice: cap out of range the first time it reads a streaming response.

Evidence (verified this run)

Line trace, pkgs/mcpx/internal/settings/value.go:

  • ParseBytes (:450-479) strips a suffix and does strconv.ParseFloat + int64(f * float64(mult)) with no sign or range check. A negative literal parses cleanly; a huge one converts out-of-range float → int64 (on amd64/arm64: math.MinInt64).
  • Validate (:481+, KindBytes case at :503) only checks that ParseBytes returned no error — so every value above is a valid setting. Apply and SetRuntime both gate on Normalize → Validate, so the bad value is admitted at every layer (file, env, flag, preset, runtime API).
  • Unguarded consumer: internal/cli/client.go:965-966 and internal/cli/opcmd.go:556-557 both do sc.Buffer(make([]byte, 0, c.set.Bytes("http.streamBufferInit")), int(c.set.Bytes("http.streamBufferMax"))) — a negative init value is a negative make cap, which panics.
  • Other consumers happen to be guarded, which is why this stayed hidden: artifacts treats MaxBytes > 0 / Quota <= 0 as "no ceiling" (internal/artifacts/artifacts.go:191,354-355) and logging substitutes the default when maxBytes <= 0 (internal/logging/file.go:86-88). Those guards silently reinterpret a negative a user actually set — worth a triage look, but the crash is the headline. http.bodyLimit / http.callBodyLimit feed http.MaxBytesReader in internal/daemon/routes_secrets.go:49,114 and server.go:870 with whatever Bytes() returns.
  • The one existing ParseBytes test (internal/settings/registry_test.go, TestByteSizesAcceptBothDecimalAndBinarySuffixes) covers only well-formed positive sizes.

Laptop probe (real internal/settings package, detached worktree at origin/main 211aa58; value.go sha256 c669f256, identical to the sandbox clone; probe + log in the goal's hidden_files/probe-2026-10-28-laneA-bytes/):

ParseBytes(-1) = -1, err=<nil>
ParseBytes(-5MB) = -5000000, err=<nil>
ParseBytes(999999999999999999999999TB) = -9223372036854775808, err=<nil>
Validate accepted byte size "-1" / "-5MB" / "999999999999999999999999TB"   (KindBytes, http.streamBufferInit decl)
Normalize accepted the same three
make([]byte, 0, ParseBytes(-1)) panicked: runtime error: makeslice: cap out of range

Baseline: with the probe removed, the full existing internal/settings suite passes on the same tree.

Why it matters

The settings system is the one choke point whose whole job is keeping an invalid value out of a running process ("a runtime change that skips the parser is the one way to get an invalid value into a running process" — value.go, SetRuntime). A size is the easiest typo to make (-1 is a common "unlimited" idiom in other tools), and here it either crashes the client at first stream or — at the guarded consumers — silently turns a set limit into "no limit / default", the opposite of what was configured. Overflow needs no malice either: 999999999999999999999999TB is what a fat-fingered or generated config produces, and it lands as the most negative int64 there is.

Acceptance criteria

  • ParseBytes (or Validate for KindBytes) refuses negative results and magnitudes that do not fit in an int64, with an error that names the offending value — ParseBytes("-1"), ParseBytes("-5MB") and the overflow case above all error.
  • A KindBytes setting therefore cannot be applied at any layer (file/env/flag/preset/runtime) with such a value; the error surfaces at apply time, not at first use.
  • Regression tests cover negative (bare and suffixed), overflow, and the existing well-formed cases (the current suffix table test keeps passing).
  • Triage confirms no consumer still spends a Bytes() value unguarded in a way a valid value can crash (e.g. an init buffer larger than the max, at the two scanner sites) — or files that separately.
  • Existing internal/settings, internal/cli and internal/daemon tests keep passing.

Notes for triage

  • Where the check lives (ParseBytes itself vs Validate-only) is the pin: ParseBytes is also called by Set.Bytes() at read time and by defaults' mustBytes for built-ins, so refusing inside ParseBytes protects every caller; refusing only in Validate leaves direct ParseBytes callers exposed.
  • Whether "0" keeps meaning "no ceiling/default" at the guarded consumers is existing documented behaviour — not part of this issue.
  • Found by new-issue-creator lane A, 2026-10-28. Distinct from mcpx(settings): Clamp validates a dial request against the ceiling's enum, not the dial's — prompt.autonomy accepts apply/off/advise/ask #1641 (settings Clamp validating a dial against the ceiling's enum — different mechanism, same package) and mcpx(logstore): Correlations counts record cross-products, not sessions — the dashboard renders '7 sessions' for a pair that co-occurs in 2, and any Query filter fails with an ambiguous-column error #1695 (logstore Correlations).

Activity

Next
  1. developing-today commented on Oct 28, 2026

    @developing-today
    developing-todayBot
    on Oct 28, 2026 – with developing.today
    Contributor
    More actions

    CODE-680

  2. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    queue/queuedHas a queued queue task
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    priority/normalOrdinary priority (the default)
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Oct 28, 2026
  3. dezren39 commented on Oct 28, 2026

    @dezren39
    dezren39
    on Oct 28, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator job (lane A, new-issue-creator-code-a)
    • Session / ID: cron new-issue-creator-code-a, run 2026-10-28 09:35 CDT
    • Found via: filed this run
    • Task: Triage the KindBytes validation gap: negative and int64-overflowing byte sizes are accepted at every settings layer, and http.streamBufferInit spent as a make() cap panics the CLI.
    • Expectation: effort/s — done when ParseBytes/Validate refuse negative and overflowing sizes at apply time, with regression tests.
    • Links: evidence and probe in the issue body; probe + log in the goal's hidden_files/probe-2026-10-28-laneA-bytes/
  4. github-actions
    assigned
    dezren39
    on Oct 28, 2026
  5. dezren39
    added
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Oct 31, 2026
  6. 16 remaining items

  7. dezren39
    added
    queue/queuedHas a queued queue task
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    and removed
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
  8. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    Agent note — triage done (task 5164, lane E)

    • Agent: queue worker (repo-worker-code), lane E
    • Task: task 5164 (triage, safety-net requeue)
    • Fresh GitHub state: mcpx(settings): byte sizes accept negatives and int64 overflow — http.streamBufferInit=-1 passes validation, then panics the CLI with 'makeslice: cap out of range' at the first streaming read #1697 OPEN, labels include queue/queued, task/small-fix — no hard-stop labels. Bug already CONFIRMED by reproduction in triage task 1915 (2026-10-31) and task 5537 (2026-11-01, clean main e8a360b; source unchanged at value.go:477). Not re-probed: two independent reproductions stand and the code path is unchanged.
    • Routing defect found and fixed: both prior triages routed the follow-up to fix task 4257 — but it sat QUEUED in repo-health-code-shadow (the repo-queue.py enqueue default-queue trap), which pilot lanes never work, so the confirmed crash bug had no live route. This shift: cancelled the stranded shadow row (reason recorded on task 4257) and re-enqueued the fix packet (hidden_files/packets/task5164-1697-parsebytes-fix.json) into repo-health-code-pilot. Verified end state: task 4257, queue repo-health-code-pilot, status queued, dedupe repo-health:v1:fix:developing-today/code:issue:1697.
    • Fix packet scope: ParseBytes refuses negative/overflowing values with an error naming the value (inside ParseBytes, per the issue's triage pin), regression tests (bare/suffixed negative, overflow, existing suffix table), consumer audit for valid-value crashes at the two scanner sites, and the cross-repo port to dezren39/nix mcpx in the same pass (one issue tracks the set). Coordinate with mcpx(settings): ParseBytes accepts non-finite spellings — NaN/Inf (bare and suffixed) validate as MinInt64, a residual #1697's sign/range checks do not catch #3521 before overlapping parser edits.
    • Outcome: triaged — mcpx(settings): byte sizes accept negatives and int64 overflow — http.streamBufferInit=-1 passes validation, then panics the CLI with 'makeslice: cap out of range' at the first streaming read #1697 stays open with a live fix route; nothing needs Drew.
    • Links: mcpx(settings): byte sizes accept negatives and int64 overflow — http.streamBufferInit=-1 passes validation, then panics the CLI with 'makeslice: cap out of range' at the first streaming read #1697 · mcpx(settings): ParseBytes accepts non-finite spellings — NaN/Inf (bare and suffixed) validate as MinInt64, a residual #1697's sign/range checks do not catch #3521 · task 5164 · task 4257 · task 1915 · task 5537
  9. dezren39
    added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    queue/queuedHas a queued queue task
    on Nov 2, 2026
  10. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    Agent note — picked up (task 4257, lane E)

    • Agent: queue worker (repo-worker-code), lane E
    • Task: task 4257 (small_fix — ParseBytes refuses negative/overflowing byte sizes; packet from triage task 5164)
    • Fresh GitHub state: mcpx(settings): byte sizes accept negatives and int64 overflow — http.streamBufferInit=-1 passes validation, then panics the CLI with 'makeslice: cap out of range' at the first streaming read #1697 OPEN, no hard-stop labels; no competing PR (verified task 5164).
    • Plan: laptop worktree on branch queue/4257-1697-parsebytes-fix; refuse inside ParseBytes (protects Set.Bytes/mustBytes callers); regression tests for bare/suffixed negatives, overflow, existing suffix table; consumer audit at the two scanner sites; then the dezren39/nix mcpx port in the same pass (or a SET-REMAINDER note on mcpx(settings): byte sizes accept negatives and int64 overflow — http.streamBufferInit=-1 passes validation, then panics the CLI with 'makeslice: cap out of range' at the first streaming read #1697).
    • Links: mcpx(settings): byte sizes accept negatives and int64 overflow — http.streamBufferInit=-1 passes validation, then panics the CLI with 'makeslice: cap out of range' at the first streaming read #1697 · mcpx(settings): ParseBytes accepts non-finite spellings — NaN/Inf (bare and suffixed) validate as MinInt64, a residual #1697's sign/range checks do not catch #3521 · task 4257 · task 5164
  11. dezren39
    added a commit that references this issue on Nov 2, 2026

    Merge pull request #4092 from developing-today/queue/4257-1697-parseb…

    8703ee5
  12. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    Agent note — done (task 4257, lane E)

    • Agent: queue worker (repo-worker-code), lane E
    • Task: task 4257 (small_fix, packet from triage task 5164)
    • Outcome: PR fix(mcpx/settings): ParseBytes refuses negative and overflowing byte sizes (#1697) #4092 merged 2026-11-02T00:37:22Z, merge commit 8703ee5. Closing mcpx(settings): byte sizes accept negatives and int64 overflow — http.streamBufferInit=-1 passes validation, then panics the CLI with 'makeslice: cap out of range' at the first streaming read #1697 on the evidence below.
    • Fix: ParseBytes (pkgs/mcpx/internal/settings/value.go) refuses scaled magnitudes >= 2^63 (size too large: "<value>") and negative results (size must not be negative: "<value>") — inside ParseBytes, so Validate/Normalize and the direct read-time callers are all protected.
    • Tests (laptop, pkgs/mcpx): new TestParseBytesRefusesNegativeAndOverflowingSizes passes (-1, -5MB, -1KiB, the TB overflow, 9223372036854775808 all error and name the value; 0 still parses; KindBytes Validate refuses the same, accepts 16MB); existing suffix table test passes; internal/cli and internal/daemon suites PASS; internal/settings failures are the identical 5 pre-existing failures verified side-by-side on clean main (document/effect/env/scriptenv declaration checks — unrelated, named by task 5537).
    • Codex: review of head 8335c28 completed, zero findings. PR CI was still pending in the Actions backlog at merge (standing merge authority: targeted tests verified, CI runs on main).
    • Consumer audit: the two scanner sites pass init/max to bufio.Scanner.Buffer, whose effective max is the larger of the two — no valid value can crash there; the negative cap was the only crash vector and is now unparseable. No follow-up issue needed.
    • Cross-repo check: no nix port is owed — dezren39/nix holds only mcpx Nix packaging; its own workflow header states "mcpx source lives only in developing-today/code now; this repo builds it from the pinned mcpx-src flake input". The fix reaches nix on the next routine mcpx-src pin bump.
    • Links: mcpx(settings): byte sizes accept negatives and int64 overflow — http.streamBufferInit=-1 passes validation, then panics the CLI with 'makeslice: cap out of range' at the first streaming read #1697 · PR fix(mcpx/settings): ParseBytes refuses negative and overflowing byte sizes (#1697) #4092 · task 4257 · task 5164 · mcpx(settings): ParseBytes accepts non-finite spellings — NaN/Inf (bare and suffixed) validate as MinInt64, a residual #1697's sign/range checks do not catch #3521 (coordinate before overlapping parser edits)
  13. dezren39
    closed this as completedon Nov 2, 2026
  14. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.