https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77696

--- Comment #10 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #5)
> I brainstormed some ideas on making these kinds of warning easier for
> the user to understand.

Here's another possible visualization, of a different overflow:

  snprintf of "%s" from:

                    |+---+ ... +---+|+---+ ... +---|
                    || 0 |     | n |||n+1|     | 31|
                    |+---+ ... +---+|+---+ ... +---|
                    vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
                    |<---   ok  --->|<--overflow-->|
                    |               |              |
  to 'buf':
    |               |               |
    ++---+ ... +---+|+---+ ... +---+|
    || 0 |     | x |||x+1|     | 15||
    ++---+ ... +---+|+---+ ... +---+|

In this one, 32 bytes are being written into an unknown point ("x+1")
within a buffer of size 16.

Reply via email to