Menu

#297 Compilation warning for test program under Ubuntu 2004

libpng_code
open
nobody
None
7
2021-07-29
2021-07-29
No

An issue with one of the test programs (buffer too small):

/prod/g480/src/libpng-1.6.37/contrib/libtests/pngstest.c: In function 'write_one_file':
/prod/g480/src/libpng-1.6.37/contrib/libtests/pngstest.c:3215:24: warning: '%d' directive writing between 1 and 11 bytes into a region of size between 10 and 32 [-Wformat-overflow=]
3215 | sprintf(name, "%s%d.png", tmpf, ++counter);
| ^~
/prod/g480/src/libpng-1.6.37/contrib/libtests/pngstest.c:3215:21: note: directive argument in the range [-2147483647, 2147483647]
3215 | sprintf(name, "%s%d.png", tmpf, ++counter);
| ^~~~~~~~~~
In file included from /usr/include/stdio.h:867,
from /prod/g480/src/libpng-1.6.37/contrib/libtests/pngstest.c:19:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: '__builtinsprintfchk' output between 6 and 38 bytes into a destination of size 32
36 | return
builtinsprintfchk (s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  Possible solution: increase size of buffer name.

Discussion


Log in to post a comment.