aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-09 13:08:16 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-09 13:08:16 +0100
commitf58f1212c16de9b5ccf696ae43a448a629eba708 (patch)
treed4c1e70df8103fbf29d1d46780c28d9bbaf19edb
parentmissed to change some parts (diff)
downloadmds-f58f1212c16de9b5ccf696ae43a448a629eba708.tar.gz
mds-f58f1212c16de9b5ccf696ae43a448a629eba708.tar.bz2
mds-f58f1212c16de9b5ccf696ae43a448a629eba708.tar.xz
report an error, rather than causing failure the caller but not for the called function
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-kbdc/compile-layout.c9
1 files changed, 9 insertions, 0 deletions
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;