# HG changeset patch # User Bryan O'Sullivan # Date 2012-05-12 08:55:08 # Node ID 5bc6edf71b39d40e46392dfe898b35284e77082b # Parent a955e05dd7a0feae8d25a4ed3c25b5fc002b1e40 parsers: ensure that nullid is always present in the radix tree diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -387,7 +387,7 @@ static const char *index_node(indexObjec Py_ssize_t length = index_length(self); const char *data; - if (pos == length - 1) + if (pos == length - 1 || pos == INT_MAX) return nullid; if (pos >= length) @@ -671,6 +671,8 @@ static int nt_init(indexObject *self) self->ntrev = (int)index_length(self) - 1; self->ntlookups = 1; self->ntmisses = 0; + if (nt_insert(self, nullid, INT_MAX) == -1) + return -1; } return 0; }