diff options
author | John Estabrook <jestabro@vyos.io> | 2023-04-26 12:23:18 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2023-04-26 12:25:02 -0500 |
commit | 5af160e9c8f0156ccc61e2e789e0839354405337 (patch) | |
tree | d4bf03f707b697748efce2bee177909c3b085f03 | |
parent | 8955c0854f42ea2d8c9b71649b03d97f27c3f1d1 (diff) | |
download | vyos1x-config-5af160e9c8f0156ccc61e2e789e0839354405337.tar.gz vyos1x-config-5af160e9c8f0156ccc61e2e789e0839354405337.zip |
T5185: drop assumption in case of a sequence of 0's
In the original implementation, it was mistakenly assumed that strings
of digits of differing lengths would not have equal value, but strings
of 0's are a counterexample.
-rw-r--r-- | src/lexical_numeric_compare.c | 6 |
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; |