Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Stopping Segmentation fault in GCC 4.2.3

Reply
Thread Tools

Stopping Segmentation fault in GCC 4.2.3

 
 
solarrobor
Guest
Posts: n/a
 
      04-14-2008
I have just bought the book "The Shellcoder's Handbook" 2nd Ed. I am
currently trying the examples that they give in the book but on my
Fedora 8 running gcc 4.2.3 I always get a segmentation fault when
trying to do the stack overflow examples. As a result I don't get the
same results when I run the executables created from the examples.

Does anybody know you I can prevent the segmentation fault from
appearing, is there a switch or do I need to get an earlier version of
GCC?

Thanks.
 
Reply With Quote
 
 
 
 
James Kanze
Guest
Posts: n/a
 
      04-15-2008
On Apr 14, 7:43 pm, solarrobor <(E-Mail Removed)> wrote:
> I have just bought the book "The Shellcoder's Handbook" 2nd Ed. I am
> currently trying the examples that they give in the book but on my
> Fedora 8 running gcc 4.2.3 I always get a segmentation fault when
> trying to do the stack overflow examples. As a result I don't get the
> same results when I run the executables created from the examples.


> Does anybody know you I can prevent the segmentation fault from
> appearing, is there a switch or do I need to get an earlier version of
> GCC?


Don't do whatever causes the segment violation. You mention
stack overflow; stack overflow is undefined behavior, but will
cause a segment violation all of the compilers I know. Or are
you doing something else wrong? (Without any code, it's
impossible to say.)

--
James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
 
 
 
James Kanze
Guest
Posts: n/a
 
      04-15-2008
On Apr 14, 8:00 pm, "Victor Bazarov" <(E-Mail Removed)> wrote:
> solarrobor wrote:
> > I have just bought the book "The Shellcoder's Handbook" 2nd Ed. I am
> > currently trying the examples that they give in the book but on my
> > Fedora 8 running gcc 4.2.3 I always get a segmentation fault when
> > trying to do the stack overflow examples. As a result I don't get the
> > same results when I run the executables created from the examples.


> > Does anybody know you I can prevent the segmentation fault from
> > appearing, is there a switch or do I need to get an earlier version of
> > GCC?


> Your question seems to be GCC specific.


Does it? With g++ (as with all other Unix based compilers I
know), there are only two things which can cause a segmentation
fault: undefined behavior in your code, or an error in the
compiler (causing it to generate wrong code). Without actually
seeing the code in question, we can't be sure which it is, but I
know which one I'd bet on.

--
James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to solve problem about "segmentation fault; core dump" in GCC? jaswinder C Programming 15 08-14-2010 12:37 AM
Segmentation fault using Firefox 15.0.2 Keith Lee Firefox 3 04-29-2006 05:45 PM
Xerces on Solaris - Segmentation fault ldvmbs@gmail.com XML 0 05-16-2005 07:21 AM
Xerces XML Parser Segmentation fault with Java Pud XML 0 11-06-2003 05:07 PM
Intel Xeon + Linux + IBM sdk 1.3.1 - getting Segmentation fault Alex Hunsley Java 17 11-06-2003 12:12 AM



Advertisments