ClickHouse / ClickHouse/clickhouse-odbc
test/client_utils.h: out-of-bound access found by Coverity
- Dominant language
- C
- Stars
- 285
- Forks
- 105
- Avg merge
- 3h 56m
- Merged PRs (30d)
- 3
Description
```
18 do {
CID 1408204 (#1 of 1): Out-of-bounds access (OVERRUN)1. overrun-buffer-arg: Overrunning array text of 10240 2-byte elements by passing it to a function which accesses it at element index 20479 (byte offset 40959) using argument 20480.
19 rc = SQLGetDiagRec(type, handle, ++i, state, &native, text, sizeof(text), &len );
20 if (SQL_SUCCEEDED(rc)) {
21 if (!result.empty())
22 result += '\n';
23 result += std::to_string(i) + ":";
24 result += "[" + toUTF8(state) + "]";
25 result += "[" + std::to_string(native) + "]";
26 result += toUTF8(text);
27 }
28 } while (rc == SQL_SUCCESS);
29
30 return result;
```
Contributor guide
Research direction
Inspect test/client_utils.h at the SQLGetDiagRec call shown in the Coverity report, starting with the declared size and type of text and the function's buffer-size argument. Confirm the diagnostic retrieval respects the allocated buffer and rerun the relevant Coverity analysis or available client utility tests to verify the overrun is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100