weston/shared
Bryce Harrington d0716f4af5 Re-apply "config-parser: Catch negative numbers assigned to unsigned config values"
[With hexadecimal color values now handled via their own routine,
re-introduce the negative unsigned numbers fix.]

strtoul() has a side effect that when given a string representing a
negative number, it treats it as a high value hexadecimal.  IOW,
strtoul("-42", &val) sets val to 0xffffffd6.  This could potentially
result in unintended surprise behaviors.

Catch this by using strtol() and then manually check for the negative
value.  This logic is modelled after Wayland's strtouint().

Note that this change unfortunately reduces the range of parseable
numbers from [0,UINT_MAX] to [0,INT_MAX].  The current users of
weston_config_section_get_uint() are anticipating numbers far smaller
than either of these limits, so the change is believed to have no impact
in practice.

Also add a test case for negative numbers that catches this error
condition.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-26 16:21:20 -07:00
..
cairo-util.c Moved helper macro to a discrete include file. 2015-06-15 17:11:45 -07:00
cairo-util.h cairo-util: return theme location from frame_touch_down 2015-12-08 13:04:34 -06:00
config-parser.c Re-apply "config-parser: Catch negative numbers assigned to unsigned config values" 2016-07-26 16:21:20 -07:00
config-parser.h config-parser: Add weston_config_section_get_color 2016-07-26 15:57:14 -07:00
file-util.c shared: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:18 -07:00
file-util.h shared: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:18 -07:00
frame.c cairo-util: return theme location from frame_touch_down 2015-12-08 13:04:34 -06:00
helpers.h Unified multiple definitions of container_of() macro. 2015-06-15 17:11:58 -07:00
image-loader.c configure: Make jpeglib an optional dependency. 2016-03-07 12:05:52 -08:00
image-loader.h shared: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:18 -07:00
matrix.c shared: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:18 -07:00
matrix.h shared: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:18 -07:00
option-parser.c option-parser: Require integer option string values to be base-10 2016-07-08 17:44:10 -07:00
os-compatibility.c log: Open log file CLOEXEC so child processes don't get the fd 2015-07-16 19:28:36 -07:00
os-compatibility.h log: Open log file CLOEXEC so child processes don't get the fd 2015-07-16 19:28:36 -07:00
platform.h shared/platform.h: remove the local EGL platform (re)definitions 2016-07-22 15:29:19 +01:00
timespec-util.h compositor,shared: add millihz_to_nsec() 2015-07-16 13:55:05 +03:00
xalloc.c Remove a wrong closing “extern "C"” in shared/xalloc.c 2016-07-11 13:22:37 -07:00
xalloc.h shared: Print .c file/line number in x* routines 2016-03-17 14:17:02 +02:00
zalloc.h shared: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:18 -07:00