[postgis-tickets] [PostGIS] #3907: gbox_to_string: snprintf warning
PostGIS
trac at osgeo.org
Tue Oct 17 09:24:28 PDT 2017
#3907: gbox_to_string: snprintf warning
------------------------+---------------------------
Reporter: Algunenano | Owner: strk
Type: defect | Status: new
Priority: low | Milestone: PostGIS 2.2.6
Component: liblwgeom | Version: trunk
Keywords: |
------------------------+---------------------------
GCC 7.2 warning in gbox_to_string:
{{{
g_box.c: In function 'gbox_to_string'
g_box.c:421:21: warning: '))' directive output may be truncated writing 2
bytes into a region of size between 0 and 105 [-Wformat-truncation=]
snprintf(str, sz, "GBOX((%.8g,%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g,%.8g))",
gbox->xmin, gbox->ymin, gbox->zmin, gbox->mmin, gbox->xmax, gbox->ymax,
gbox->zmax, gbox->mmax);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:862:0,
from liblwgeom_internal.h:40,
from g_box.c:29:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output
between 26 and 138 bytes into a destination of size 128
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}}}
The destination buffer is set too small to handle the max size of the
string so it might get truncated.
Github PR: https://github.com/postgis/postgis/pull/165
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3907>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list