clickhouse-odbc icon indicating copy to clipboard operation
clickhouse-odbc copied to clipboard

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

Open chipitsine opened this issue 6 years ago • 2 comments

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;

chipitsine avatar Dec 01 '19 20:12 chipitsine

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

traceon avatar Dec 01 '19 21:12 traceon

I'm not sure it is reproducible.

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

chipitsine avatar Dec 02 '19 04:12 chipitsine