From ed8e3e4d02eaf17553c9aae0646287e68d468924 Mon Sep 17 00:00:00 2001 From: Rangi Date: Tue, 7 Jul 2026 16:44:14 -0400 Subject: [PATCH] Reset `errno = 0` before `parseWholeNumber` calls and `errno == ERANGE` checks --- src/asm/main.cpp | 1 + src/asm/opt.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/asm/main.cpp b/src/asm/main.cpp index bc79014a..bd0f0917 100644 --- a/src/asm/main.cpp +++ b/src/asm/main.cpp @@ -267,6 +267,7 @@ static void parseArg(int ch, char *arg) { } case 'r': + errno = 0; if (std::optional maxDepth = parseWholeNumber(arg); !maxDepth) { fatal("Invalid argument for option '-r'"); } else if (errno == ERANGE) { diff --git a/src/asm/opt.cpp b/src/asm/opt.cpp index 08978d41..70e5c94f 100644 --- a/src/asm/opt.cpp +++ b/src/asm/opt.cpp @@ -105,6 +105,7 @@ void opt_Parse(char const *s) { break; case 'r': + errno = 0; if (std::optional maxRecursionDepth = parseWholeNumber(s); !maxRecursionDepth) { error("Invalid argument for option 'r'"); } else if (errno == ERANGE) {