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 640695 - g_key_file_load_from_file() mishandles a CR-LF that spans a 4 KB boundary
g_key_file_load_from_file() mishandles a CR-LF that spans a 4 KB boundary
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.27.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-01-27 08:03 UTC by Benjamin Gilbert
Modified: 2011-01-28 04:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test case (1.76 KB, text/plain)
2011-01-27 08:03 UTC, Benjamin Gilbert
  Details
Patch (1.25 KB, patch)
2011-01-27 08:07 UTC, Benjamin Gilbert
none Details | Review

Description Benjamin Gilbert 2011-01-27 08:03:36 UTC
Created attachment 179414 [details]
Test case

Overview:
If g_key_file_load_from_file() is given a key file with CR-LF line endings, and a CR-LF sequence in the file straddles a 4096-byte boundary, the CR will not be properly stripped from the line it terminates.

Steps to Reproduce:
1. Create a key file with the properties described above, where each key contains an integer value.
2. Load the key file with g_key_file_load_from_file().
3. Use g_key_file_get_integer() to get each integer from the GKeyFile.

Actual results:
g_key_file_get_integer() produces an error when reading a key whose CR-LF terminator spans a 4 KB boundary.

Expected results:
All values should be read successfully.

Additional info:
Test case and patch attached.
Comment 1 Benjamin Gilbert 2011-01-27 08:07:54 UTC
Created attachment 179415 [details] [review]
Patch
Comment 2 Matthias Clasen 2011-01-28 04:08:29 UTC
Thanks. Added with a testcase