ClickHouse / clickhouse-odbc

ODBC driver for ClickHouse
https://clickhouse.tech
Apache License 2.0
247 stars 88 forks source link

test/client_utils.h: out-of-bound access found by Coverity #216

Open chipitsine opened 4 years ago

chipitsine commented 4 years ago
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;
traceon commented 4 years ago

Thanks for the find! Do you have precise steps to reproduce?

chipitsine commented 4 years ago

I'm not sure it is reproducible.

I ran scan.coverity.com build It might be false positive