ARPA-SIMC / dballe

Fast on-disk database for meteorological observed and forecast data.
Other
19 stars 6 forks source link

[Fedora 32] format-truncation error #211

Closed brancomat closed 4 years ago

brancomat commented 4 years ago

a truncation error seems to prevent f32 builds

see: https://copr.fedorainfracloud.org/coprs/simc/stable/build/1304588/

relevant bit:

/bin/sh ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  -DTABLE_DIR=\"/usr/share/wreport\" -I.. -I..    -I/usr/include/mysql -I/usr/include/mysql/..    -Werror   -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c -o core/libdballe_la-benchmark.lo `test -f 'core/benchmark.cc' || echo './'`core/benchmark.cc
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -DTABLE_DIR=\"/usr/share/wreport\" -I.. -I.. -I/usr/include/mysql -I/usr/include/mysql/.. -Werror -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c core/benchmark.cc  -fPIC -DPIC -o core/.libs/libdballe_la-benchmark.o
core/benchmark.cc: In function 'std::string dballe::benchmark::format_clockdiff(const timespec&, const timespec&)':
core/benchmark.cc:63:32: error: '%03lu' directive output may be truncated writing between 3 and 14 bytes into a region of size between 11 and 30 [-Werror=format-truncation=]
   63 |         snprintf(buf, 32, "%lu.%03lus", secs, nsecs / 1000000);
      |                                ^~~~~
core/benchmark.cc:63:27: note: directive argument in the range [0, 18446744073709]
   63 |         snprintf(buf, 32, "%lu.%03lus", secs, nsecs / 1000000);
      |                           ^~~~~~~~~~~~
In file included from /usr/include/stdio.h:867,
                 from /usr/include/c++/10/cstdio:42,
                 from /usr/include/c++/10/ext/string_conversions.h:43,
                 from /usr/include/c++/10/bits/basic_string.h:6505,
                 from /usr/include/c++/10/string:55,
                 from core/benchmark.h:8,
                 from core/benchmark.cc:1:
/usr/include/bits/stdio2.h:67:35: note: '__builtin___snprintf_chk' output between 7 and 37 bytes into a destination of size 32
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
spanezz commented 4 years ago

It look like that was the only problem, the CI is green now also for F32!