File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -393,7 +393,12 @@ _swift_stdlib_strtoX_clocale_impl<float>(const char *str, float *result) {
393
393
}
394
394
395
395
char *end;
396
+ _set_errno (0 );
396
397
*result = _strtof_l (str, &end, getCLocale ());
398
+ if (*result == HUGE_VALF || *result == -HUGE_VALF || *result == 0.0 || *result == -0.0 ) {
399
+ if (errno == ERANGE)
400
+ end = nullptr ;
401
+ }
397
402
return end;
398
403
}
399
404
@@ -406,7 +411,12 @@ _swift_stdlib_strtoX_clocale_impl<double>(const char *str, double *result) {
406
411
}
407
412
408
413
char *end;
414
+ _set_errno (0 );
409
415
*result = _strtod_l (str, &end, getCLocale ());
416
+ if (*result == HUGE_VAL || *result == -HUGE_VAL || *result == 0.0 || *result == -0.0 ) {
417
+ if (errno == ERANGE)
418
+ end = nullptr ;
419
+ }
410
420
return end;
411
421
}
412
422
@@ -419,7 +429,12 @@ _swift_stdlib_strtoX_clocale_impl<long double>(const char *str, long double *res
419
429
}
420
430
421
431
char *end;
432
+ _set_errno (0 );
422
433
*result = _strtod_l (str, &end, getCLocale ());
434
+ if (*result == HUGE_VALL || *result == -HUGE_VALL || *result == 0.0 || *result == -0.0 ) {
435
+ if (errno == ERANGE)
436
+ end = nullptr ;
437
+ }
423
438
return end;
424
439
}
425
440
#endif
You can’t perform that action at this time.
0 commit comments