summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--lib.c2
-rw-r--r--match.c4
3 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2ff209e4..3bc68f5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2012-02-28 Kaz Kylheku <kaz@kylheku.com>
+ * lib.c (numberp): Fix bad type check: null pointer dereference when
+ object is nil.
+
+ * match.c (do_match_line): Bugfix for incorrect treatment of long
+ lines. Must return the absolute position from the start of the original
+ line (plus(c->pos, c->base)), rather than just c->pos, which only
+ measures from the start of a line that may have been chopped by
+ consume_prefix.
+
+2012-02-28 Kaz Kylheku <kaz@kylheku.com>
+
Bugfix: rlcp function was incorrect for new way of storing
line number info.
diff --git a/lib.c b/lib.c
index 9f2b48ed..b23b1598 100644
--- a/lib.c
+++ b/lib.c
@@ -1143,6 +1143,8 @@ val numberp(val num)
case TAG_NUM:
return t;
case TAG_PTR:
+ if (num == nil)
+ return nil;
if (num->t.type == BGNUM)
return t;
/* fallthrough */
diff --git a/match.c b/match.c
index bf6b82a6..3fb64b0b 100644
--- a/match.c
+++ b/match.c
@@ -1198,7 +1198,7 @@ static val do_match_line(match_line_ctx *c)
c->specline = cdr(c->specline);
}
- debug_return (cons(c->bindings, c->pos));
+ debug_return (cons(c->bindings, plus(c->pos, c->base)));
debug_leave;
}
@@ -3510,7 +3510,7 @@ repeat_spec_same_data:
match_line(ml_all(c.bindings, specline, dataline, zero,
c.data_lineno, first(c.files))));
- if (fixnump(success) && c_num(success) < c_num(length_str(dataline))) {
+ if (numberp(success) && length_str_gt(dataline, success)) {
debuglf(specline, lit("spec only matches line to position ~a: ~a"),
success, dataline, nao);
debug_return (nil);