Skip to content

proc: fix infinite loop in mapIteratorSwiss.next - #4433

Merged
derekparker merged 1 commit into
go-delve:masterfrom
aarzilli:fixinfinitemapaccess
Aug 31, 2026
Merged

derekparker merged 1 commit into
go-delve:masterfrom
aarzilli:fixinfinitemapaccess

Conversation

@aarzilli

Copy link
Copy Markdown
Member

Fixes a bug found by the fuzzer in
https://github.com/go-delve/delve/actions/runs/32555989728.

If the table length is too large (because of memory corruption) the
multiplication between that value and the size of the group struct can
overflow. If the overflow is just right the resulting stride will be
zero, causing the loop in mapIteratorSwiss.next to never progress.

Also changes said loop to respect maxNumGroups even when we can't load
any tables but dirLen is large. This is unrelated to the fuzzer bug, it
was merely spotted during the investigation.

We might need some other mechanism to stop the search in mapAccess
early if the table is enormous, or appears to be because of memory
corruption, but doesn't cause an integer overflow. However there are no
obvious limits to impose there so leave it for now.

@aarzilli

Copy link
Copy Markdown
Member Author

What do we want to do with testdata? The fuzz directory is pretty small but it needs the executable and the coredump to run and those are big and different every time they are run. I don't want to push multiple 40MB objects into the repository, since it's not something users are interested in downloading.

Fixes a bug found by the fuzzer in
https://github.com/go-delve/delve/actions/runs/32555989728.

If the table length is too large (because of memory corruption) the
multiplication between that value and the size of the group struct can
overflow. If the overflow is just right the resulting stride will be
zero, causing the loop in mapIteratorSwiss.next to never progress.

Also changes said loop to respect maxNumGroups even when we can't load
any tables but dirLen is large. This is unrelated to the fuzzer bug, it
was merely spotted during the investigation.

We might need some other mechanism to stop the search in mapAccess
early if the table is enormous, or appears to be because of memory
corruption, but doesn't cause an integer overflow. However there are no
obvious limits to impose there so leave it for now.
@aarzilli
aarzilli force-pushed the fixinfinitemapaccess branch from 407ba51 to 1800382 Compare August 28, 2026 16:43

@derekparker derekparker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekparker
derekparker merged commit 5fd4d7a into go-delve:master Aug 31, 2026
6 checks passed
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
delve 1.27.2

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed
* proc/native: update Windows syscall generator by @typesanitizer in go-delve/delve#4404
* *: add scripts to setup / run eval fuzzer and run in CI by @derekparker in go-delve/delve#4412
* proc: export LoadFullValue as return-by-value helper by @derekparker in go-delve/delve#4411
* build: pin github actions to commit shas and declare workflow permissions by @Totara-thib in go-delve/delve#4405
* build: add plumber workflow security check by @Totara-thib in go-delve/delve#4406
* pkg/proc: Defer pointer cast to syscall invoking function by @typesanitizer in go-delve/delve#4414
* service/dap: print "ps aux" before exiting tests by @aarzilli in go-delve/delve#4417
* proc: do not nest memCache objects by @aarzilli in go-delve/delve#4418
* ci: fail early when a release is already published by @FranciscoPombal in go-delve/delve#4408
* release: make interrupted draft uploads rerunnable by @FranciscoPombal in go-delve/delve#4409
* build(deps): bump github.com/cilium/ebpf from 0.11.0 to 0.22.0 by @dependabot[bot] in go-delve/delve#4422
* ci: upgrade GitHub Actions and pin GoReleaser by @derekparker in go-delve/delve#4427
* proc: advance through FreeBSD process snapshots by @typesanitizer in go-delve/delve#4421
* service/dap: honor the frame and goroutine of the SetVariable scope by @larrasket in go-delve/delve#4419
* tests: report error with t.Fatal if we can't compile a fixture by @aarzilli in go-delve/delve#4424
* debugger: close resumeNotify early with the halt command by @aarzilli in go-delve/delve#4425
* ci: upload fuzz crashers as GitHub Actions artifacts by @derekparker in go-delve/delve#4428
* tests: regenerate capslock by @aarzilli in go-delve/delve#4426
* ci: run the FreeBSD tests on GitHub Actions by @neilpang in go-delve/delve#4432
* terminal,service,proc: add set next statement (jump) command by @larrasket in go-delve/delve#4434
* proc/native: poll wait4 on FreeBSD to avoid a lost wakeup by @neilpang in go-delve/delve#4435
* proc: fix infinite loop in mapIteratorSwiss.next by @aarzilli in go-delve/delve#4433
* proc: do not call debuginfod-find right after attach by @aarzilli in go-delve/delve#4431
* dap: add types command to list program types by @larrasket in go-delve/delve#4439
* gobuild: keep -C first for test builds by @cuishuang in go-delve/delve#4444
* proc: fix range-over-func next test on linux/loong64 by @loongson-zn in go-delve/delve#4441
* proc,service: emit events while calling DownloadLibraryDebugInfo by @aarzilli in go-delve/delve#4438
* goversion: format versioned development builds correctly by @cuishuang in go-delve/delve#4445
* *: v1.27.2 by @derekparker in go-delve/delve#4446

## New Contributors
* @Totara-thib made their first contribution in go-delve/delve#4405
* @dependabot[bot] made their first contribution in go-delve/delve#4422
* @neilpang made their first contribution in go-delve/delve#4432
* @loongson-zn made their first contribution in go-delve/delve#4441

**Curated Changelog**: https://github.com/go-delve/delve/blob/master/CHANGELOG.md#1272-2026-09-08
**Full Changelog**: https://github.com/go-delve/delve/compare/v1.27.1...v1.27.2</pre>
  <p>View the full release notes at <a href="https://github.com/go-delve/delve/releases/tag/v1.27.2">https://github.com/go-delve/delve/releases/tag/v1.27.2</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!18816
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.

2 participants