Skip to content

Conversation

vlsi
Copy link
Member

@vlsi vlsi commented Jan 27, 2025

This is a re-implementation of #3492

java.lang.ArrayIndexOutOfBoundsException: null
at java.security.jgss/sun.security.jgss.GSSContextImpl.unwrap
at sun.security.jgss.GSSContextImpl.wrap(GSSContextImpl.java:385)
at org.postgresql.gss.GSSOutputStream.writeWrapped(GSSOutputStream.java:52)
at org.postgresql.gss.GSSOutputStream.write(GSSOutputStream.java:76)
at java.io.FilterOutputStream.write(FilterOutputStream.java:97)
at org.postgresql.core.PGStream.send(PGStream.java:398)

GSSOutputStream does not handle the buffer switch correctly, when a message is bigger than the GSS buffer due to a wrong buffer variable usage.

GSSInputStream did not handle input streams that produced incomplete reads as it ignored the result of .read(...)

…nection, make GSSInputStream robust in face of streams that produce incomplete reads

fix this error stack

```
java.lang.ArrayIndexOutOfBoundsException: null
at java.security.jgss/sun.security.jgss.GSSContextImpl.unwrap
at sun.security.jgss.GSSContextImpl.wrap(GSSContextImpl.java:385)
at org.postgresql.gss.GSSOutputStream.writeWrapped(GSSOutputStream.java:52)
at org.postgresql.gss.GSSOutputStream.write(GSSOutputStream.java:76)
at java.io.FilterOutputStream.write(FilterOutputStream.java:97)
at org.postgresql.core.PGStream.send(PGStream.java:398)
```

GSSOutputStream does not handle the buffer switch correctly, when a
message is bigger than the GSS buffer due to a wrong buffer variable usage.

GSSInputStream did not handle input streams that produced incomplete reads as
it ignored the result of .read(...)

Co-authored-by: Sasasu <i@sasa.su>
@vlsi vlsi merged commit 96f6862 into pgjdbc:master Jan 28, 2025
14 of 15 checks passed
@vlsi vlsi deleted the gss branch May 16, 2025 12:43
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

Successfully merging this pull request may close these issues.

1 participant