Commit 9bd11e0
fix: guard memcpy against null _ptr in Poco::Buffer::setCapacity
When a Buffer is default-constructed (_ptr = nullptr, _used = 0),
calling setCapacity with newCapacity > 0 and preserveContent = true
computes newSz = 0 and then calls memcpy(dst, nullptr, 0).
Passing a null pointer to memcpy is undefined behaviour even when size
is 0 (the nonnull attribute on argument 2 applies regardless of size).
UBSan correctly flags this and with abort_on_error=1 the ClickHouse
server process aborts during Poco::CompressedLogFile construction
before binding port 9000, causing integration tests to time out.
Fix: skip the memcpy when newSz == 0.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>1 parent afcfb5e commit 9bd11e0
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
| 159 | + | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
| |||
0 commit comments