Merge pull request #22655 from azat/system.errors-invalid-read

Fix impossible invalid-read for system.errors accounting
This commit is contained in:
alexey-milovidov 2021-04-06 14:48:33 +03:00 committed by GitHub
commit 3708821689
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -590,7 +590,7 @@ namespace ErrorCodes
void increment(ErrorCode error_code, bool remote, const std::string & message, const FramePointers & trace)
{
if (error_code >= end())
if (error_code < 0 || error_code >= end())
{
/// For everything outside the range, use END.
/// (end() is the pointer pass the end, while END is the last value that has an element in values array).