* gc.c (get_envparam_int): don't accept a value equals to lowerbound

(changed by last commit) because "" or "foo" (not a number) strings
  are parsed as 0. They should be rejected.
* gc.c (get_envparam_double): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2014-02-06 06:26:01 +00:00
Родитель c6c6a74fed
Коммит cb410ff932
2 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Thu Feb 6 15:17:30 2014 Koichi Sasada <ko1@atdot.net>
* gc.c (get_envparam_int): don't accept a value equals to lowerbound
(changed by last commit) because "" or "foo" (not a number) strings
are parsed as 0. They should be rejected.
* gc.c (get_envparam_double): ditto.
Thu Feb 6 09:00:35 2014 Koichi Sasada <ko1@atdot.net>
* gc.c (ruby_gc_set_params): if RUBY_GC_OLDMALLOC_LIMIT is provided,
@ -5,7 +13,7 @@ Thu Feb 6 09:00:35 2014 Koichi Sasada <ko1@atdot.net>
Without this fix, the env variable RUBY_GC_OLDMALLOC_LIMIT
does not work.
* gc.c (get_envparam_int): accept a value equals to lowerbounds.
* gc.c (get_envparam_int): accept a value equals to lowerbound.
* gc.c (get_envparam_double): ditto.

4
gc.c
Просмотреть файл

@ -5653,7 +5653,7 @@ get_envparam_int(const char *name, unsigned int *default_value, int lower_bound)
if (ptr != NULL) {
val = atoi(ptr);
if (val >= lower_bound) {
if (val > lower_bound) {
if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%d (%d)\n", name, val, *default_value);
*default_value = val;
return 1;
@ -5673,7 +5673,7 @@ get_envparam_double(const char *name, double *default_value, double lower_bound)
if (ptr != NULL) {
val = strtod(ptr, NULL);
if (val >= lower_bound) {
if (val > lower_bound) {
if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (%f)\n", name, val, *default_value);
*default_value = val;
return 1;