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 657359 - Crash when specifying data length in gtk_css_provider_load_from_data
Crash when specifying data length in gtk_css_provider_load_from_data
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.1.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-08-25 17:53 UTC by Michael Terry
Modified: 2011-08-26 14:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test program (258 bytes, text/x-csrc)
2011-08-25 17:53 UTC, Michael Terry
  Details
Proposed patch (1.00 KB, patch)
2011-08-25 18:47 UTC, Michael Terry
none Details | Review

Description Michael Terry 2011-08-25 17:53:35 UTC
Created attachment 194727 [details]
Test program

gtk_css_provider_load_from_data allows to specify data length, but will crash if given anything that isn't null-capped:

"Gtk:ERROR:/build/buildd/gtk+3.0-3.1.12/./gtk/gtkcssprovider.c:1275:gtk_css_scanner_new: assertion failed: (data[length] == 0)"

A test program is attached.  Compile with:

gcc provider.c `pkg-config --libs --cflags gtk+-3.0`
Comment 1 Michael Terry 2011-08-25 18:47:50 UTC
Created attachment 194736 [details] [review]
Proposed patch

Here's a patch that g_strndup's incoming strings to ensure a null ending byte.  It also removes the length argument from the function that asserted, removing the need for the assert.
Comment 2 Benjamin Otte (Company) 2011-08-26 14:36:16 UTC
Turns out my branch that fixes that wasn't pushed. Bad me.

Pushed it now and added your testsuite inside the testsuite.