typelevel / typelevel/skunk

SSLTest index out of bounds

Open
#859 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.7k
Forks
175
Avg merge
5d 14h
Merged PRs (30d)
9

Description

First noticed in #858

==> X tests.issue.Test238.see (https://github.com/functional-streams-for-scala/fs2/pull/1989)  0.023s javax.net.ssl.SSLException: Fail to unwrap network record
    at sun.security.ssl.Alert.createSSLException(Alert.java:133)
    at sun.security.ssl.TransportContext.fatal(TransportContext.java:360)
    at sun.security.ssl.TransportContext.fatal(TransportContext.java:303)
    at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:470)
    at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:433)
    at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:637)
    at fs2.io.net.tls.TLSEngine$$anon$1.$anonfun$unwrap$1(TLSEngine.scala:158)
    at fs2.io.net.tls.InputOutputBuffer$$anon$1.$anonfun$perform$3(InputOutputBuffer.scala:92)
    at delay @ fs2.io.net.tls.InputOutputBuffer$$anon$1.$anonfun$perform$2(InputOutputBuffer.scala:90)
    at get @ skunk.util.Pool$.free$1(Pool.scala:156)
    at flatMap @ fs2.io.net.tls.InputOutputBuffer$$anon$1.$anonfun$perform$1(InputOutputBuffer.scala:89)
    at get @ skunk.util.Pool$.free$1(Pool.scala:156)
    at flatMap @ fs2.io.net.tls.InputOutputBuffer$$anon$1.perform(InputOutputBuffer.scala:88)
    at flatTap @ skunk.net.protocol.Unroll.unroll(Unroll.scala:86)
    at flatMap @ fs2.io.net.tls.TLSEngine$$anon$1.unwrap(TLSEngine.scala:160)
    at get @ skunk.util.Pool$.free$1(Pool.scala:156)
    at map @ fs2.io.net.tls.InputOutputBuffer$$anon$1.inputRemains(InputOutputBuffer.scala:124)
    at map @ fs2.io.net.tls.TLSEngine$$anon$1.unwrapThenTakeUnwrapped(TLSEngine.scala:189)
    at ifM$extension @ fs2.io.net.tls.TLSEngine$$anon$1.unwrapThenTakeUnwrapped(TLSEngine.scala:189)
    at flatMap @ fs2.io.net.tls.TLSEngine$$anon$1.read0(TLSEngine.scala:134)
Caused by: java.lang.IndexOutOfBoundsException
    at java.nio.Buffer.checkIndex(Buffer.java:687)
    at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:169)
    at sun.security.ssl.SSLEngineInputRecord.bytesInCompletePacket(SSLEngineInputRecord.java:113)
    at sun.security.ssl.SSLEngineInputRecord.bytesInCompletePacket(SSLEngineInputRecord.java:64)
    at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:557)
    at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:454)
    at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:433)
    at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:637)
    at fs2.io.net.tls.TLSEngine$$anon$1.$anonfun$unwrap$1(TLSEngine.scala:158)
    at fs2.io.net.tls.InputOutputBuffer$$anon$1.$anonfun$perform$3(InputOutputBuffer.scala:92)
    at cats.effect.IOFiber.runLoop(IOFiber.scala:255)
    at cats.effect.IOFiber.execR(IOFiber.scala:1317)
    at cats.effect.IOFiber.run(IOFiber.scala:112)
    at cats.effect.unsafe.WorkerThread.run(WorkerThread.scala:555)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failing Test238.see referenced in #858 and inspect fs2.io.net.tls.TLSEngine.unwrap together with InputOutputBuffer.perform, especially the lines named in the trace. Reproduce the SSLException and determine the expected handling for the IndexOutOfBoundsException; the issue does not specify a fix or completion test.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgres, scala
Domain
databases, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.