diff options
author | Russ Cox <rsc@swtch.com> | 2009-12-06 17:27:08 -0800 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2009-12-06 17:27:08 -0800 |
commit | 846cec9ebc33dcbdd93d425a92fab6bc7acf355c (patch) | |
tree | b70ddbbeab4c49dad63155ec6ab737ec8234d48d /src/cmd/sam | |
parent | 1d919bc08079e8f6221b3e83150374fe876989c8 (diff) | |
download | plan9port-846cec9ebc33dcbdd93d425a92fab6bc7acf355c.tar.gz plan9port-846cec9ebc33dcbdd93d425a92fab6bc7acf355c.tar.bz2 plan9port-846cec9ebc33dcbdd93d425a92fab6bc7acf355c.zip |
sam: fix off-by-one in buffer merge.
exposed by UTFmax==4
R=rsc
http://codereview.appspot.com/165071
Diffstat (limited to 'src/cmd/sam')
-rw-r--r-- | src/cmd/sam/file.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/sam/file.c b/src/cmd/sam/file.c index c0771e05..07d73bb9 100644 --- a/src/cmd/sam/file.c +++ b/src/cmd/sam/file.c @@ -139,7 +139,7 @@ loginsert(File *f, uint p0, Rune *s, uint ns) if(merge.f != f || p0-(merge.p0+merge.n)>Maxmerge /* too far */ - || merge.nbuf+((p0+ns)-(merge.p0+merge.n))>RBUFSIZE) /* too long */ + || merge.nbuf+((p0+ns)-(merge.p0+merge.n))>=RBUFSIZE) /* too long */ flushmerge(); if(ns>=RBUFSIZE){ @@ -178,7 +178,7 @@ logdelete(File *f, uint p0, uint p1) if(merge.f != f || p0-(merge.p0+merge.n)>Maxmerge /* too far */ - || merge.nbuf+(p0-(merge.p0+merge.n))>RBUFSIZE){ /* too long */ + || merge.nbuf+(p0-(merge.p0+merge.n))>=RBUFSIZE){ /* too long */ flushmerge(); merge.f = f; merge.p0 = p0; |