weston/tests
Bryce Harrington 6351fb08c2 config-parser: Catch negative numbers assigned to unsigned config values
strtoul() has a side effect that when given a string representing a
negative number, it returns a negated version as the value, and does not
flag an error.  IOW, strtoul("-42", &val) sets val to 42.  This could
potentially result in unintended surprise behaviors, such as if one were
to inadvertantly set a config param to -1 expecting that to disable it,
but with the result of setting the param to 1 instead.

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-12 15:50:05 -07:00
..
reference tests/internal-screenshot: Fix test so it doesn't expect shell surfaces 2015-05-26 11:26:06 +03:00
.gitignore Revert "gitignore: Ignore generated header test files" 2015-05-26 23:22:19 -07:00
bad-buffer-test.c Remove redundant #include path component. 2015-06-15 17:11:09 -07:00
buffer-count-test.c Remove redundant #include path component. 2015-06-15 17:11:09 -07:00
button-test.c tests: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:19 -07:00
config-parser-test.c config-parser: Catch negative numbers assigned to unsigned config values 2016-07-12 15:50:05 -07:00
devices-test.c devices-test: Fix typo 'destroyes' in a comment 2015-10-20 08:35:43 -07:00
event-test.c tests: event-test to use create_shm_buffer_a8r8g8b8() 2016-06-29 12:39:30 +03:00
internal-screenshot-test.c tests: implement visualize_image_difference() 2016-06-29 12:41:31 +03:00
internal-screenshot.ini tests: Add internal test for the weston test screenshot capability 2015-05-21 15:06:11 -07:00
ivi-shell-app-test.c tests: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:19 -07:00
ivi-test.h ivi-shell: implement surface_on_many_layer test 2016-06-29 11:32:23 +03:00
ivi_layout-internal-test.c Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
ivi_layout-test-plugin.c ivi-shell: implement surface_on_many_layer test 2016-06-29 11:32:23 +03:00
ivi_layout-test.c tests: ivi_layout-test to use create_shm_buffer_a8r8g8b8() 2016-06-29 12:41:31 +03:00
keyboard-test.c Coding style fixes 2015-08-07 12:01:22 -07:00
matrix-test.c Remove redundant #include path component. 2015-06-15 17:11:09 -07:00
plugin-registry-test.c compositor: add plugin-registry 2016-07-01 14:10:26 +03:00
presentation-test.c tests: introduce struct buffer for client-helper 2016-06-29 12:39:30 +03:00
roles-test.c tests: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:19 -07:00
setbacklight.c tests: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:19 -07:00
subsurface-test.c tests: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:19 -07:00
surface-global-test.c Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
surface-screenshot.c input: Don't test keyboard/pointer/touch pointers 2015-07-31 15:16:09 -07:00
surface-test.c Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
text-test.c Use text input protocol from wayland-protocols 2015-11-19 13:07:10 +02:00
vertex-clip-test.c Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
viewporter-test.c tests: introduce struct buffer for client-helper 2016-06-29 12:39:30 +03:00
weston-test-client-helper.c tests: implement visualize_image_difference() 2016-06-29 12:41:31 +03:00
weston-test-client-helper.h tests: implement visualize_image_difference() 2016-06-29 12:41:31 +03:00
weston-test-runner.c tests: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:19 -07:00
weston-test-runner.h Moved helper macro to a discrete include file. 2015-06-15 17:11:45 -07:00
weston-test.c tests: update for manual surface/view mapping 2016-07-01 15:29:26 +03:00
weston-tests-env tests: print the command line to log 2016-06-23 18:15:43 +03:00
xwayland-test.c tests: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:19 -07:00