[jerryx-arg]Check NaN in jerryx_arg_int

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
This commit is contained in:
Zidong Jiang
2017-08-11 15:38:47 +08:00
committed by yichoi
parent c1cff3f961
commit 2888a6f488
2 changed files with 46 additions and 8 deletions
+6
View File
@@ -132,6 +132,12 @@ jerryx_arg_helper_process_double (double *d, /**< [in, out] the number to be pro
double max, /**< the max value for clamping */
jerryx_arg_int_option_t option) /**< the converting policies */
{
if (isnan (*d))
{
return jerry_create_error (JERRY_ERROR_TYPE,
(jerry_char_t *) "The number is NaN.");
}
if (option.clamp == JERRYX_ARG_NO_CLAMP)
{
if (*d > max || *d < min)