Avoid overflow (src/backend/utils/adt/formatting.c)

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема Avoid overflow (src/backend/utils/adt/formatting.c)
Дата
Msg-id CAEudQAo-sk5jpjgPw=U=V7DOhSdQtU9APMRHkr4aV2SxtviqRw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Avoid overflow (src/backend/utils/adt/formatting.c)
Список pgsql-hackers
Hi.

Per Coverity.

Coverity raised the follow report:

CID 1642824: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
37. overflow_const: Expression pattern_len - 1ULL, where pattern_len is known to be equal to 0, underflows the type of pattern_len - 1ULL, which is type unsigned long long.

This is because the function *pg_mbstrlen* can return zero.
And the comment is clear, *just in case there are MB chars*.

patch attached.

best regards,
Ranier Vilela
Вложения

В списке pgsql-hackers по дате отправления: