Mercurial > hg-stable
changeset 17353:bde1185f406c stable
revlog: don't try to partialmatch strings those length > 40
_partialmatch() does prefix matching against nodes. String passed
to _partialmetch() actualy may be any string, not prefix only.
For example,
"e410be8603932e46a51298748a4b874739037fad or 300" is a good
argument for _partialmatch().
When _partialmatch() searches using radix tree, index_partialmatch()
C function shouldn't try to match too long strings.
author | sorcerer |
---|---|
date | Thu, 02 Aug 2012 19:10:45 +0400 |
parents | 9d9d15928521 |
children | c87ba0a6fb79 935831597e16 |
files | mercurial/parsers.c |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/parsers.c Sat Aug 11 12:45:37 2012 -0500 +++ b/mercurial/parsers.c Thu Aug 02 19:10:45 2012 +0400 @@ -1084,8 +1084,10 @@ return NULL; } - if (nodelen > 40) - nodelen = 40; + if (nodelen > 40) { + PyErr_SetString(PyExc_ValueError, "key too long"); + return NULL; + } for (i = 0; i < nodelen; i++) hexdigit(node, i);