summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-02-28 23:22:58 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-02-28 23:22:58 -0800
commit9c70c2b50bb44aebcd2d01e605d7712492c7de0e (patch)
tree89f6b3060176eb5e1efa8ae9b69a6fc3750c504a /lib.c
parent088da243fce2d4f5fca08bbce2fa27d5076d811b (diff)
downloadtxr-9c70c2b50bb44aebcd2d01e605d7712492c7de0e.tar.gz
txr-9c70c2b50bb44aebcd2d01e605d7712492c7de0e.tar.bz2
txr-9c70c2b50bb44aebcd2d01e605d7712492c7de0e.zip
* 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.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c2
1 files changed, 2 insertions, 0 deletions
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 */