summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--RELNOTES5
-rw-r--r--lib.c4
-rw-r--r--match.c3
4 files changed, 19 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e51f06ba..4101ba1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2011-11-23 Kaz Kylheku <kaz@kylheku.com>
+ * lib.c (plus, minus): Fixed wrong assertion which would incorrectly
+ fire for inputs that do not overflow.
+
+ * match.c (search_form): Fixed incorrect loop test which could
+ lead to nonterminating behavior.
+
+ * RELNOTES: Updated.
+
+2011-11-23 Kaz Kylheku <kaz@kylheku.com>
+
Semantics change. If a variable is followed by a mixture
of text and regular expressions, that whole mixture is
considered to follow the variable and used for matching.
diff --git a/RELNOTES b/RELNOTES
index 9f9c16a1..3fadec42 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -12,6 +12,11 @@
- thus @foo bar behaves properly once again; it is not treated
as foo followed by the regex / +/, ignoring the text bar.
+ - Infinite looping bug in negative match with longest-match semantics.
+
+ - Bug in the overflow detection in the lib.c plus and minus function.
+
+
(current release)
TXR 042
diff --git a/lib.c b/lib.c
index c1d27c97..1076bb2c 100644
--- a/lib.c
+++ b/lib.c
@@ -733,7 +733,7 @@ val plus(val anum, val bnum)
cnum b = c_num(bnum);
numeric_assert (a <= 0 || b <= 0 || NUM_MAX - b >= a);
- numeric_assert (a >= 0 || b >= 0 || NUM_MIN - b >= a);
+ numeric_assert (a >= 0 || b >= 0 || NUM_MIN - b <= a);
return num(a + b);
}
@@ -745,7 +745,7 @@ val minus(val anum, val bnum)
numeric_assert (b != NUM_MIN || NUM_MIN == -NUM_MAX);
numeric_assert (a <= 0 || -b <= 0 || NUM_MAX + b >= a);
- numeric_assert (a >= 0 || -b >= 0 || NUM_MIN + b >= a);
+ numeric_assert (a >= 0 || -b >= 0 || NUM_MIN + b <= a);
return num(a - b);
}
diff --git a/match.c b/match.c
index 9f49657d..cc61479e 100644
--- a/match.c
+++ b/match.c
@@ -426,7 +426,8 @@ static val search_form(match_line_ctx *c, val needle_form, val from_end)
rlcp(spec, needle_form);
- for (; (from_end && ge(pos, c->pos)) || length_str_ge(c->dataline, pos);
+ for (; (from_end && ge(pos, c->pos)) ||
+ (!from_end && length_str_ge(c->dataline, pos));
pos = plus(pos, step))
{
cons_bind (new_bindings, new_pos,