| From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
|---|---|
| To: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Avoid overflow (src/backend/utils/adt/formatting.c) |
| Date: | 2025-11-02 14:59:35 |
| Message-ID: | CAEudQAo-sk5jpjgPw=U=V7DOhSdQtU9APMRHkr4aV2SxtviqRw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| Attachment | Content-Type | Size |
|---|---|---|
| avoid-overflow-formatting.patch | application/octet-stream | 650 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Banck | 2025-11-02 15:11:43 | Re: Include extension path on pg_available_extensions |
| Previous Message | Christian Ullrich | 2025-11-02 13:05:47 | C nitpick about pgwin32_dispatch_queued_signals() |