public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56458] New: support for crash on invalid array access
@ 2013-02-26 11:41 wbrana at gmail dot com
  2013-02-26 11:49 ` [Bug c/56458] " jakub at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: wbrana at gmail dot com @ 2013-02-26 11:41 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56458

             Bug #: 56458
           Summary: support for crash on invalid array access
    Classification: Unclassified
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: wbrana@gmail.com


GCC could support command-line flag for at least C and C++, which would enable
checking of array access, which would increase security.
If wrong access is detected, process should crash, but following code returns
two zeros. 

#include <iostream>
using namespace std;

int array[5];

inline void crash() {
        int* v = 0;
        *v = 0;
}

int read1(int i) {
        return array[i];
}

int write1(int i) {
        return array[i] = 0;
}

int main(int i, char* argv[]) {
        cout << read1(i + 100) << endl;
        cout << write1(i + 100) << endl;
        return 0;
}


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

* [Bug c/56458] support for crash on invalid array access
  2013-02-26 11:41 [Bug c/56458] New: support for crash on invalid array access wbrana at gmail dot com
@ 2013-02-26 11:49 ` jakub at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-26 11:49 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56458

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-26 11:49:13 UTC ---
GCC supports -fmudflap and starting with 4.8 also -fsanitize=address.  The
latter might not detect access off by 100 bytes, but if it is <= 32 (or often
up to < 64) bytes, it will be detected.


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

end of thread, other threads:[~2013-02-26 11:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-26 11:41 [Bug c/56458] New: support for crash on invalid array access wbrana at gmail dot com
2013-02-26 11:49 ` [Bug c/56458] " jakub 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).