From a5ccc4066f45d447dfddec469d4da3572a0f83c8 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 25 Feb 2024 01:18:15 +0100 Subject: [PATCH] fixed using strtod() by resetting errno to detect overflow/underflow --- src/game_bd/bd_bdcff.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/game_bd/bd_bdcff.c b/src/game_bd/bd_bdcff.c index 8f2ee081..4c57c14e 100644 --- a/src/game_bd/bd_bdcff.c +++ b/src/game_bd/bd_bdcff.c @@ -254,6 +254,7 @@ static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_ break; case GD_TYPE_PROBABILITY: + errno = 0; /* must be reset before calling strtod() to detect overflow/underflow */ res = strtod(params[paramindex], NULL); if (errno == 0 && res >= 0 && res <= 1) { @@ -268,6 +269,7 @@ static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_ break; case GD_TYPE_RATIO: + errno = 0; /* must be reset before calling strtod() to detect overflow/underflow */ res = strtod (params[paramindex], NULL); if (errno == 0 && res >= 0 && res <= 1) { -- 2.34.1