Change information
Commit message:
semaphore: panic on negative weights
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: ee6289c356f4626ebca52dbe86d856cc713d7be0
GitHub-Pull-Request: golang/sync#31
Files:
- M semaphore/semaphore.go
- M semaphore/semaphore_test.go
Change size: M
Delta: 2 files changed, 47 insertions(+), 4 deletions(-)
Branch: refs/heads/master