From f58f1212c16de9b5ccf696ae43a448a629eba708 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 9 Dec 2014 13:08:16 +0100 Subject: report an error, rather than causing failure the caller but not for the called function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-kbdc/compile-layout.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mds-kbdc/compile-layout.c b/src/mds-kbdc/compile-layout.c index 0df48eb..c9ff65d 100644 --- a/src/mds-kbdc/compile-layout.c +++ b/src/mds-kbdc/compile-layout.c @@ -1087,6 +1087,15 @@ static size_t parse_variable(mds_kbdc_tree_t* restrict tree, const char* restric var = (size_t)atoll(dotless + 1); if (strlen(dotless + 1) != (size_t)snprintf(NULL, 0, "%zu", var)) fail_if ((errno = ERANGE)); + if (var == 0) + { + NEW_ERROR(tree, INTERNAL_ERROR, + "parsed a variable string to be 0, which should not be possible"); + error->start = lineoff; + error->end = lineoff + strlen(raw_); + tree->processed = PROCESS_LEVEL; + return 1; + } return var; fail: return 0; -- cgit v1.2.3-70-g09d2