etcd
etcd copied to clipboard
fix(pkg/ioutil):avoid panic in PageWriter.Write() when pageBytes is 0
pkg/ioutil: add check for pageBytes when creating PageWriter
NewPageWriter() without check could return a PageWriter whose pageBytes is equal to 0. This is fatal when buffer to write is longer than defaultBufferBytes, and it will crashed in PageWriter.Write() with: "panic: runtime error: integer divide by zero". This check will prevent creating PageWriter in NewPageWriter()when pageBytes is 0, and return a nil at that time.
Codecov Report
Merging #14022 (29d30ab) into main (b7be91f) will increase coverage by
0.02%. The diff coverage is62.50%.
:exclamation: Current head 29d30ab differs from pull request most recent head 76112f1. Consider uploading reports for the commit 76112f1 to get more accurate results
@@ Coverage Diff @@
## main #14022 +/- ##
==========================================
+ Coverage 75.00% 75.03% +0.02%
==========================================
Files 450 446 -4
Lines 37173 36723 -450
==========================================
- Hits 27882 27555 -327
+ Misses 7522 7432 -90
+ Partials 1769 1736 -33
| Flag | Coverage Δ | |
|---|---|---|
| all | 75.03% <62.50%> (+0.02%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| etcdctl/ctlv3/command/watch_command.go | 44.08% <0.00%> (ø) |
|
| server/etcdmain/etcd.go | 41.25% <25.00%> (-4.12%) |
:arrow_down: |
| server/etcdmain/config.go | 86.12% <71.42%> (+0.85%) |
:arrow_up: |
| etcdctl/ctlv3/command/txn_command.go | 63.15% <100.00%> (-4.39%) |
:arrow_down: |
| etcdctl/ctlv3/command/util.go | 17.97% <100.00%> (ø) |
|
| client/pkg/v3/verify/verify.go | 88.46% <0.00%> (-11.54%) |
:arrow_down: |
| server/proxy/grpcproxy/register.go | 81.39% <0.00%> (-9.31%) |
:arrow_down: |
| server/auth/simple_token.go | 80.00% <0.00%> (-8.47%) |
:arrow_down: |
| server/etcdserver/api/v3lock/lock.go | 61.53% <0.00%> (-8.47%) |
:arrow_down: |
| etcdctl/ctlv3/command/printer_simple.go | 53.08% <0.00%> (-8.03%) |
:arrow_down: |
| ... and 17 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update b7be91f...76112f1. Read the comment docs.
Please also rebase this PR.
@secsys-go Please update this PR per the comment.
Please squash the commits.
Again, please squash the commits into just one commit. FYI. git-squash
This is the squashed one:dc559c17979a1823fab7c80478c74b4db28e0f1b
Since there is no response from the author for a long time, so I resolved it in https://github.com/etcd-io/etcd/pull/14452