Bug 18856

Summary: gtk_clist_get_text() causes segfault
Product: [Retired] Red Hat Linux Reporter: Sean Dilda <smdilda>
Component: gtk+Assignee: Owen Taylor <otaylor>
Status: CLOSED NOTABUG QA Contact: Dale Lovelace <dale>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: katzj
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-10-16 15:20:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
This is the sample code that will work in RH62, but not RH70 none

Description Sean Dilda 2000-10-10 22:03:36 UTC
I have sample code that works fine on Red Hat 6.2, but when compiled and
run on a Red Hat 7.0 box, the program segfaults in gtk_clist_get_text()
As far as I can tell, all my code for this is valid.

Comment 1 Sean Dilda 2000-10-10 22:04:41 UTC
Created attachment 4004 [details]
This is the sample code that will work in RH62, but not RH70

Comment 2 Owen Taylor 2000-10-16 15:36:32 UTC
  gchar **celltext;

  [...]

  gtk_clist_get_text(GTK_CLIST(clist), row, 0, celltext);

You are telling GTK+ to store the text in the location pointed
to by celltext, but celltext is unitialized, so you are telling
GTK+ to store it in random memory. If it worked with 6.2
it was complete and utter coincidence.

Try:

  gchar *celltext;

  gtk_clist_get_text(GTK_CLIST(clist), row, 0, &celltext);

To avoid problems like this, you should

 * Compile with -Wall
 * Believe the warnings
 * Read up a bit on pointers