[jerryx-arg]Check NaN in jerryx_arg_int

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang [email protected]
This commit is contained in:
Zidong Jiang authored and yichoi committed 2017-08-17 09:15:35 +09:00
1 parent c1cff3f961
commit 2888a6f488
2 files changed
+46 -8

No files matched your search

+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)