summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2023-04-26 19:05:59 +0100
committerGitHub <noreply@github.com>2023-04-26 19:05:59 +0100
commitceed15b2b064b36c0f49d2142ebe0dafeaa34267 (patch)
treed4bf03f707b697748efce2bee177909c3b085f03
parent8955c0854f42ea2d8c9b71649b03d97f27c3f1d1 (diff)
parent5af160e9c8f0156ccc61e2e789e0839354405337 (diff)
downloadvyos1x-config-ceed15b2b064b36c0f49d2142ebe0dafeaa34267.tar.gz
vyos1x-config-ceed15b2b064b36c0f49d2142ebe0dafeaa34267.zip
Merge pull request #16 from jestabro/compare-bug
T5185: drop assumption in case of a sequence of 0's
-rw-r--r--src/lexical_numeric_compare.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lexical_numeric_compare.c b/src/lexical_numeric_compare.c
index e1395d7..3905f3f 100644
--- a/src/lexical_numeric_compare.c
+++ b/src/lexical_numeric_compare.c
@@ -66,9 +66,9 @@ CAMLprim value caml_lex_numeric_compare(value str1, value str2) {
return Val_int(0);
}
- // if here, pos1 == pos2, or something is horribly wrong
- if (pos1 != pos2) caml_failwith(inconsistent);
- pos = pos1;
+ // if a sequence of 0's were encountered, it is possible that
+ // pos1 != pos2; adjust
+ pos = pos1 > pos2 ? pos2 : pos1;
p1 = s1;
p2 = s2;
len = len - pos;