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 491752 - gtk_tree_path_new_from_string() needs range checking
gtk_tree_path_new_from_string() needs range checking
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
2.12.x
Other Linux
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks:
 
 
Reported: 2007-10-30 14:42 UTC by Federico Mena Quintero
Modified: 2018-02-10 03:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtk2-bnc223606-bgo491752-tree-path-strtol-validation.diff (1.90 KB, patch)
2007-11-14 16:47 UTC, Federico Mena Quintero
none Details | Review
gtk2-bnc223606-bgo491752-tree-path-strtol-validation.diff (2.03 KB, patch)
2007-11-14 17:10 UTC, Federico Mena Quintero
none Details | Review

Description Federico Mena Quintero 2007-10-30 14:42:04 UTC
gtk_tree_path_new_from_string() uses a simple strtol() to parse out each component between the ":".  This several problems:

* The code doesn't check for overflow/underflow:  strtol() will return LONG_MIN/LONG_MAX and set errno to ERANGE if it overflows.

* The code assigns the result of strtol() to an int, without checking if it fits.
Comment 1 Federico Mena Quintero 2007-10-30 14:43:01 UTC
This is https://bugzilla.novell.com/show_bug.cgi?id=223606 as well.
Comment 2 Federico Mena Quintero 2007-11-14 16:47:43 UTC
Created attachment 99094 [details] [review]
gtk2-bnc223606-bgo491752-tree-path-strtol-validation.diff
Comment 3 Federico Mena Quintero 2007-11-14 17:10:18 UTC
Created attachment 99098 [details] [review]
gtk2-bnc223606-bgo491752-tree-path-strtol-validation.diff

Ahem, #include <errno.h>
Comment 4 Morten Welinder 2007-11-15 20:23:46 UTC
Nit picker's comments:

1. strtol is locale dependent, at least in principle.
2. testing errno against 0 is not good, I think.  A succeeding
   libc function can change errno.
3. is g_warning really right here?  They trigger for data errors here, not
   programmer's errors.
4. What about whitespace?  It is allowed before numbers, but not after.
Comment 5 Matthias Clasen 2018-02-10 03:40:15 UTC
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and
still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue
for it.