Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: withReadableRange/limitReadableRange #31

Open
lchenut opened this issue Jul 13, 2022 · 0 comments
Open

Bug: withReadableRange/limitReadableRange #31

lchenut opened this issue Jul 13, 2022 · 0 comments

Comments

@lchenut
Copy link
Contributor

lchenut commented Jul 13, 2022

With this simple code:

import stew/byteutils
import faststreams

proc readAll(s: InputStream): seq[byte] =
  while s.readable:
    result.add s.read

let s = fileInput("AlphabetFile") # A => Z, 26 characters file
for _ in 0..5:
  if s.readable(4):
    s.withReadableRange(4, r):
      echo string.fromBytes(r.readAll)

I got this output:

ABCD
/home/lchenut/minnim/sf/faststreams/inputs.nim(363) lol
/home/lchenut/minnim/sf/faststreams/inputs.nim(351) limitReadableRange
/home/lchenut/.choosenim/toolchains/nim-1.6.6/lib/system/fatal.nim(53) sysFatal
Error: unhandled exception: over- or underflow [OverflowDefect]

I tried to figure out why it's failing (or even if it's an expected result) for the last two days, with no luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant