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

decodeWithCharset doesn't flush #2664

Closed
rossabaker opened this issue Oct 5, 2021 · 0 comments · Fixed by #2667
Closed

decodeWithCharset doesn't flush #2664

rossabaker opened this issue Oct 5, 2021 · 0 comments · Fixed by #2667
Labels

Comments

@rossabaker
Copy link
Member

rossabaker commented Oct 5, 2021

In fs2-3.1.3, this test fails:

    // Found by scalacheck in old http4s implementation
    test("handle overflow") {
      if (isJVM) { // Charset not supported by Scala.js
        val cs = Charset.forName("x-ISCII91")
        val s = Stream(-36.toByte)
          .covary[Fallible]
          .through(decodeWithCharset(cs))
          .compile
          .string
        assertEquals(s, Right(""))
      }
    }

The output buffer is sized to one character based on chunk length and average size queried from the decoder, but the byte expands to two characters. We need to check the CoderResult for an overflow. [edit: misdiagnosis]

This is one of the rare character sets that needs to be flushed after the final input. You can find more here.

@rossabaker rossabaker added the bug label Oct 5, 2021
@rossabaker rossabaker changed the title decodeWithCharset doesn't handle overflow results decodeWithCharset doesn't flush Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant