nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
ropes: Fix a buffer overflow in `RopeBuffer.add`.
[nit.git]
/
lib
/
standard
/
ropes.nit
diff --git
a/lib/standard/ropes.nit
b/lib/standard/ropes.nit
index
9ef2f4d
..
d41c021
100644
(file)
--- a/
lib/standard/ropes.nit
+++ b/
lib/standard/ropes.nit
@@
-337,14
+337,13
@@
class RopeBuffer
redef fun add(c) do
var rp = rpos
- length += 1
- ns[rp] = c
- rp += 1
- if rp == buf_size then
- rpos = rp
+ if rp >= buf_size then
dump_buffer
rp = 0
end
+ ns[rp] = c
+ rp += 1
+ length += 1
rpos = rp
end