public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/92942] missing -Wstringop-overflow for allocations with a negative lower bound size
       [not found] <bug-92942-4@http.gcc.gnu.org/bugzilla/>
@ 2020-08-27 18:52 ` msebor at gcc dot gnu.org
  2020-09-09 21:46 ` msebor at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-08-27 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2020-08-27
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Testing a fix.

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

* [Bug middle-end/92942] missing -Wstringop-overflow for allocations with a negative lower bound size
       [not found] <bug-92942-4@http.gcc.gnu.org/bugzilla/>
  2020-08-27 18:52 ` [Bug middle-end/92942] missing -Wstringop-overflow for allocations with a negative lower bound size msebor at gcc dot gnu.org
@ 2020-09-09 21:46 ` msebor at gcc dot gnu.org
  2020-10-27 14:34 ` cvs-commit at gcc dot gnu.org
  2020-10-27 14:37 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-09-09 21:46 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552903.html

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

* [Bug middle-end/92942] missing -Wstringop-overflow for allocations with a negative lower bound size
       [not found] <bug-92942-4@http.gcc.gnu.org/bugzilla/>
  2020-08-27 18:52 ` [Bug middle-end/92942] missing -Wstringop-overflow for allocations with a negative lower bound size msebor at gcc dot gnu.org
  2020-09-09 21:46 ` msebor at gcc dot gnu.org
@ 2020-10-27 14:34 ` cvs-commit at gcc dot gnu.org
  2020-10-27 14:37 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-27 14:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:c0b09c1296d5334d1d264ba4d39ca932f9572330

commit r11-4441-gc0b09c1296d5334d1d264ba4d39ca932f9572330
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Oct 27 08:31:53 2020 -0600

    Add tests for PR92942 - missing -Wstringop-overflow for allocations with a
negative lower bound size.

    gcc/testsuite/ChangeLog:

            PR middle-end/92942
            * gcc.dg/Wstringop-overflow-56.c: New test.
            * gcc.dg/Wstringop-overflow-57.c: Same.

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

* [Bug middle-end/92942] missing -Wstringop-overflow for allocations with a negative lower bound size
       [not found] <bug-92942-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-10-27 14:34 ` cvs-commit at gcc dot gnu.org
@ 2020-10-27 14:37 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-10-27 14:37 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |11.0
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=97342
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
The patch referenced in comment #2 was never reviewed but the bug was resolved
by the improvements to compute_objsize() committed as part of the fix for
pr97342.  GCC 11 detects both buffer overflows:

$ gcc -O2 -S -Wall pr92942.c
pr92942.c: In function ‘f’:
pr92942.c:10:3: warning: ‘__builtin_memcpy’ writing 6 bytes into a region of
size between 0 and 3 [-Wstringop-overflow=]
   10 |   strcpy (p, "12345");   // buffer overflow detected
      |   ^~~~~~~~~~~~~~~~~~~
pr92942.c:9:13: note: at offset 0 to an object with size at most 3 allocated by
‘malloc’ here
    9 |   void *p = malloc (n);
      |             ^~~~~~~~~~
pr92942.c: In function ‘g’:
pr92942.c:20:3: warning: ‘__builtin_memcpy’ writing 6 bytes into a region of
size between 0 and 3 [-Wstringop-overflow=]
   20 |   strcpy (p, "12345");   // buffer overflow not detected
      |   ^~~~~~~~~~~~~~~~~~~
pr92942.c:19:13: note: at offset 0 to an object with size at most 3 allocated
by ‘malloc’ here
   19 |   void *p = malloc (n);
      |             ^~~~~~~~~~

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

end of thread, other threads:[~2020-10-27 14:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-92942-4@http.gcc.gnu.org/bugzilla/>
2020-08-27 18:52 ` [Bug middle-end/92942] missing -Wstringop-overflow for allocations with a negative lower bound size msebor at gcc dot gnu.org
2020-09-09 21:46 ` msebor at gcc dot gnu.org
2020-10-27 14:34 ` cvs-commit at gcc dot gnu.org
2020-10-27 14:37 ` msebor at gcc dot gnu.org

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 read-only IMAP folder(s) and NNTP newsgroup(s).