Commit f3ab16c
committed
MB-70730 Fix crash from progress bar getting win size
Previously we used `ioctl` directly to get the terminal size which was
error-prone. We were passing a four character string as a buffer. The
argument for `TIOCGWINSZ` should be four `unsigned short`s long and
`unsigned short` is at least two bytes, so the call was overflowing a
buffer.
This didn't seem to cause a problem in practice, but recently the Python
we ship was upgraded to 3.14 which catches these errors [1]. This caused
a `None` to propagate and later accessed.
We now use `termio.tcgetwinsize` to get the terminal size, and we add
another `None` check.
[1] python/cpython#132915
Change-Id: I6a6a636ca466edd3ef5f711b74002c36522e6044
Reviewed-on: https://review.couchbase.org/c/couchbase-cli/+/240979
Reviewed-by: Lubo Marinski <lubo.marinski@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>
Well-Formed: Restriction Checker1 parent 82f338b commit f3ab16c
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| |||
0 commit comments