discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Dirty compile with GCC 7.5
@ 2020-07-02  5:27 Jeffrey Walton
  2020-07-02 17:21 ` Ingo Schwarze
  0 siblings, 1 reply; 2+ messages in thread
From: Jeffrey Walton @ 2020-07-02  5:27 UTC (permalink / raw)
  To: discuss

tbl_html.c: In function ‘print_tbl’:
tbl_html.c:191:9: warning: ‘%d’ directive output may be truncated
writing between 1 and 10 bytes into a region of size 4
[-Wformat-truncation=]
        "%d", dp->hspans + 1);
         ^~
tbl_html.c:191:8: note: directive argument in the range [2, 2147483647]
        "%d", dp->hspans + 1);
        ^~~~
In file included from /usr/include/stdio.h:862:0,
                 from tbl_html.c:23:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note:
‘__builtin___snprintf_chk’ output between 2 and 11 bytes into a
destination of size 4
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tbl_html.c:197:9: warning: ‘%d’ directive output may be truncated
writing between 1 and 10 bytes into a region of size 4
[-Wformat-truncation=]
        "%d", dp->vspans + 1);
         ^~
tbl_html.c:197:8: note: directive argument in the range [2, 2147483647]
        "%d", dp->vspans + 1);
        ^~~~
In file included from /usr/include/stdio.h:862:0,
                 from tbl_html.c:23:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note:
‘__builtin___snprintf_chk’ output between 2 and 11 bytes into a
destination of size 4
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Dirty compile with GCC 7.5
  2020-07-02  5:27 Dirty compile with GCC 7.5 Jeffrey Walton
@ 2020-07-02 17:21 ` Ingo Schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Schwarze @ 2020-07-02 17:21 UTC (permalink / raw)
  To: Jeffrey Walton; +Cc: discuss

Hi Jeffrey,

Jeffrey Walton wrote on Thu, Jul 02, 2020 at 01:27:47AM -0400:

> tbl_html.c: In function "print_tbl":
> tbl_html.c:191:9: warning: "%d" directive output may be truncated
> writing between 1 and 10 bytes into a region of size 4
> [-Wformat-truncation=]
>         "%d", dp->hspans + 1);
>          ^~
> tbl_html.c:191:8: note: directive argument in the range [2, 2147483647]
>         "%d", dp->hspans + 1);
>         ^~~~

That's an obvious false positive from the compiler.
The number of spans cannot reasonably be larger than about ten.
If there are more than 9999 spans, well, then a smaller number will
be written into the "colspan" HTML attribute, which is perfectly
harmless.  A document containing a table with so many spans makes
no sense in the first place.

The code is explicitly annotated as

	(void)snprintf(...)

meaning that it was audited and it was determined that truncation
is harmless.

So, what is your point?

You failed to say why you reported this.

Do you suspect a bug?
If so, what do you think could go wrong?

Yours,
  Ingo
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-02 17:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02  5:27 Dirty compile with GCC 7.5 Jeffrey Walton
2020-07-02 17:21 ` Ingo Schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).