diff options
author | bptato <nincsnevem662@gmail.com> | 2024-03-05 17:15:01 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-03-05 17:18:55 +0100 |
commit | d7412afcbfbcdcc865dfa44973cebc14708f62e3 (patch) | |
tree | 13fbb2ae302ae4494a7a0078acf1557a1499bc4b /src/server | |
parent | db98b828bbd793a8af8d9fe35936dafb233bae8f (diff) | |
download | chawan-d7412afcbfbcdcc865dfa44973cebc14708f62e3.tar.gz |
buffer: fix bug of eating chars before invalid UTF-8
using this API is suffering (`n' is the last *valid* character ever since the validator API got fixed, so it must be included in the slice.)
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/buffer.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/server/buffer.nim b/src/server/buffer.nim index 749c31d8..c303577c 100644 --- a/src/server/buffer.nim +++ b/src/server/buffer.nim @@ -729,8 +729,8 @@ proc validateData(buffer: Buffer, iq: openArray[char]): bool = if buffer.canSwitch: buffer.switchCharset() return false - if n > pi: - doAssert buffer.processData0(iq.toOpenArray(pi, n - 1)) + if n >= pi: + doAssert buffer.processData0(iq.toOpenArray(pi, n)) doAssert buffer.processData0("\uFFFD") pi = buffer.validator.i true |