semaphore: panic on negative weights#31
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
dc49db9 to
8e7d04e
Compare
|
This PR (HEAD: 8e7d04e) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/sync/+/796080. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be Please don’t reply on this GitHub thread. Visit golang.org/cl/796080. |
8e7d04e to
1964698
Compare
|
Message from Alan Donovan: Patch Set 1: Code-Review+2 (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/796080. |
|
Message from Alan Donovan: Patch Set 1: -Code-Review Please don’t reply on this GitHub thread. Visit golang.org/cl/796080. |
|
This PR (HEAD: 1964698) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/sync/+/796080. Important tips:
|
1964698 to
ee6289c
Compare
|
Message from Alan Donovan: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/796080. |
|
This PR (HEAD: ee6289c) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/sync/+/796080. Important tips:
|
|
Message from Zain Yousef: Patch Set 2: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/796080. |
|
Message from Alan Donovan: Patch Set 3: Auto-Submit+1 Code-Review+2 Commit-Queue+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/796080. |
|
Message from golang-scoped@luci-project-accounts.iam.gserviceaccount.com: Patch Set 3: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2026-07-01T13:21:25Z","revision":"51d829c5cefbb71c50fd06184caf21f4a7ddc3d4"} Please don’t reply on this GitHub thread. Visit golang.org/cl/796080. |
|
Message from Alan Donovan: Patch Set 3: -Commit-Queue (Performed by <GERRIT_ACCOUNT_60063> on behalf of <GERRIT_ACCOUNT_57259>) Please don’t reply on this GitHub thread. Visit golang.org/cl/796080. |
|
Message from golang-scoped@luci-project-accounts.iam.gserviceaccount.com: Patch Set 3: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/796080. |
|
Message from golang-scoped@luci-project-accounts.iam.gserviceaccount.com: Patch Set 3: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/796080. |
|
Message from Damien Neil: Patch Set 3: Code-Review+2 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/796080. |
The semaphore.Weighted API accepts int64 for weights. If a negative weight is passed, it mathematically corrupts the internal state tracker (s.cur) and bypasses the package's existing safety checks. This adds strict boundary validation to panic immediately if a negative weight is provided. Fixes golang/go#80183
ee6289c to
f19eea2
Compare
The semaphore.Weighted API accepts int64 for weights. If a negative weight is passed, it mathematically corrupts the internal state tracker (s.cur) and bypasses the package's existing safety checks. This adds strict boundary validation to panic immediately if a negative weight is provided. Fixes golang/go#80183 Change-Id: I7e74bad404a8b99aef7e3d2189dda43f8ea644c2 GitHub-Last-Rev: ee6289c GitHub-Pull-Request: #31 Reviewed-on: https://go-review.googlesource.com/c/sync/+/796080 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Zain Yousef <zain.19dj@gmail.com> Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Alan Donovan <adonovan@google.com>
|
This PR is being closed because golang.org/cl/796080 has been merged. |
The semaphore.Weighted API accepts int64 for weights. If a negative
weight is passed, it mathematically corrupts the internal state tracker
(s.cur) and bypasses the package's existing safety checks.
This adds strict boundary validation to panic immediately if a negative
weight is provided.
Fixes golang/go#80183