After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 616432 - Crash in gschema-compile
Crash in gschema-compile
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gsettings
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Allison Karlitskaya (desrt)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-04-21 20:13 UTC by Shaun McCance
Modified: 2010-04-22 09:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Example XML file that might crash gschema-compile (302 bytes, text/xml)
2010-04-21 20:13 UTC, Shaun McCance
  Details
Proposed patch (1.57 KB, patch)
2010-04-21 20:14 UTC, Shaun McCance
none Details | Review

Description Shaun McCance 2010-04-21 20:13:55 UTC
Created attachment 159280 [details]
Example XML file that might crash gschema-compile

gschema-compile was with a realloc on an invalid pointer in GString. I'll attach the XML file I used. Note that minor changes would get around the crash for me, so this file may not cause a crash for you. It comes down to when memory happens to be overwritten.

I'm also attaching what I think is the correct fix. The end_element function frees state->string, then the text function attempts to access it. I think start_element is supposed to create the GString, but it doesn't for "min" and "max" element. My patch sets state->string to NULL whenever it's freed, as a precaution, and creates a new GString for min and max.
Comment 1 Shaun McCance 2010-04-21 20:14:30 UTC
Created attachment 159281 [details] [review]
Proposed patch
Comment 2 Matthias Clasen 2010-04-21 22:10:50 UTC
Thanks, I've pushed a fix
Comment 3 Shaun McCance 2010-04-22 04:58:40 UTC
Thanks Matthias. The fix you pushed prevents the invalid memory access, but since it doesn't create a GString for min and max elements, I get "text may not appear inside <min>".
Comment 4 Christian Persch 2010-04-22 09:39:59 UTC
The patch in bug 616102 will fix that. (It probably now doesn't apply cleanly anymore...:/)