complier warnings from ecpg tests

From: Sergei Kornilov <sk(at)zsrv(dot)org>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: complier warnings from ecpg tests
Date: 2019-07-11 12:21:15
Message-ID: 14951331562847675@sas2-a1efad875d04.qloud-c.yandex.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

I noticed few warnings from my compiler (gcc version 8.3.0 (Debian 8.3.0-6)) during make check-world:

array.pgc: In function ‘main’:
array.pgc:41:16: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Wformat-overflow=]
sprintf(str, "2000-1-1 0%d:00:00", j);
^~~~~~~~~~~~~~~~~~~~
array.pgc:41:16: note: directive argument in the range [-2147483648, 9]
array.pgc:41:3: note: ‘sprintf’ output between 18 and 28 bytes into a destination of size 20
sprintf(str, "2000-1-1 0%d:00:00", j);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
array.pgc:43:16: warning: ‘sprintf’ may write a terminating nul past the end of the destination [-Wformat-overflow=]
sprintf(str, "2000-1-1%d\n", j);
^~~~~~~~~~~~~~
array.pgc:43:3: note: ‘sprintf’ output between 11 and 21 bytes into a destination of size 20
sprintf(str, "2000-1-1%d\n", j);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

They coming from src/interfaces/ecpg tests ( ./src/interfaces/ecpg/test/sql/array.pgc ).
Seems this code is 4 year old but I did not found discussion related to such compiler warnings. Is this expected?

regards, Sergei

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Cramer 2019-07-11 12:23:22 Re: let's make the list of reportable GUCs configurable (was Re: Add %r substitution for psql prompts to show recovery status)
Previous Message Edmund Horner 2019-07-11 12:11:58 Re: Tid scan improvements