help request: Usage of fopen() leading to heap overflows

Andrew Haley aph-gcc@littlepinkcloud.COM
Wed May 9 09:27:00 GMT 2007


Dragon writes:
 > My code compiles fine with gcc. 4.1.1
 > 
 > gcc /home/path/indo18b.c -o /home/path/indo18b -lm -lz

 > I have traced the offending line to the fopen statement. Read through all 
 > documentation I could find that indicates I am not doing anything really 
 > strange or wrong.

Yes, you are.

 > Am I missing something?
 > 
 > Please suggest solution....I am using Fedora Core 5. Embarrassingly, I admit I 
 > am unsure how to adjust the heap or stack. 

You're trashing memory with a wild pointer write somewhere in your
code.  Valgrind is a good tools to use at this point.

Andrew.



More information about the Gcc-help mailing list