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

Parser fails with StringIndexOutOfBoundsException when encountering invalid PostgreSQL unicode literal #16347

Closed
lukaseder opened this issue Feb 27, 2024 · 2 comments

Comments

@lukaseder
Copy link
Member

parsing E'\\Uasdf' leads to this exception:

java.lang.StringIndexOutOfBoundsException: Range [4, 4 + 8) out of bounds for length 9
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromIndexSize(Preconditions.java:118)
	at java.base/jdk.internal.util.Preconditions.checkFromIndexSize(Preconditions.java:397)
	at java.base/java.lang.String.checkBoundsOffCount(String.java:4849)
	at java.base/java.lang.String.rangeCheck(String.java:307)
	at java.base/java.lang.String.<init>(String.java:303)
	at org.jooq.impl.DefaultParseContext.parseUnquotedStringLiteral(ParserImpl.java:13750)
	at org.jooq.impl.DefaultParseContext.parseStringLiteralIf(ParserImpl.java:13510)
	at org.jooq.impl.DefaultParseContext.parseStringLiteral(ParserImpl.java:13497)
	at org.jooq.impl.DefaultParseContext.parseTerm(ParserImpl.java:8866)
	at org.jooq.impl.DefaultParseContext.parseUnaryOps(ParserImpl.java:8389)
	at org.jooq.impl.DefaultParseContext.parseExp(ParserImpl.java:8363)
	at org.jooq.impl.DefaultParseContext.parseFactor(ParserImpl.java:8340)
	at org.jooq.impl.DefaultParseContext.parseSum(ParserImpl.java:8281)
	at org.jooq.impl.DefaultParseContext.parseNumericOp(ParserImpl.java:8230)
	at org.jooq.impl.DefaultParseContext.parseCollated(ParserImpl.java:8079)
	at org.jooq.impl.DefaultParseContext.parseConcat(ParserImpl.java:8060)
	at org.jooq.impl.DefaultParseContext.parsePredicate(ParserImpl.java:6770)
	at org.jooq.impl.DefaultParseContext.parseNot(ParserImpl.java:6601)
	at org.jooq.impl.DefaultParseContext.parseAnd(ParserImpl.java:6591)
	at org.jooq.impl.DefaultParseContext.parseXor(ParserImpl.java:6582)
	at org.jooq.impl.DefaultParseContext.parseOr(ParserImpl.java:6573)
	at org.jooq.impl.DefaultParseContext.parseField(ParserImpl.java:7976)
	at org.jooq.impl.DefaultParseContext.lambda$10(ParserImpl.java:1018)
	at org.jooq.impl.DefaultParseContext.wrap(ParserImpl.java:15356)
	at org.jooq.impl.DefaultParseContext.parseField0(ParserImpl.java:1018)
	at org.jooq.impl.ParserImpl.parseField(ParserImpl.java:857)
	at org.jooq.impl.ParserImpl.parseField(ParserImpl.java:852)
	at org.jooq.impl.AbstractParserTest.failAll(AbstractParserTest.java:230)
	at org.jooq.impl.AbstractParserTest.failAllFields(AbstractParserTest.java:273)
	at org.jooq.impl.ParserLiteralTest.testStringLiteral(ParserLiteralTest.java:217)

Instead, a ParserException should be thrown

@lukaseder
Copy link
Member Author

After fixing this, there's still a NumberFormatException:

lukaseder added a commit that referenced this issue Feb 27, 2024
This includes:

- [#16347] Parser fails with StringIndexOutOfBoundsException when encountering invalid PostgreSQL unicode literal
lukaseder added a commit that referenced this issue Feb 27, 2024
This includes:

- [#16347] Parser fails with StringIndexOutOfBoundsException when encountering invalid PostgreSQL unicode literal
lukaseder added a commit that referenced this issue Feb 27, 2024
This includes:

- [#16347] Parser fails with StringIndexOutOfBoundsException when encountering invalid PostgreSQL unicode literal
lukaseder added a commit that referenced this issue Feb 27, 2024
This includes:

- [#16347] Parser fails with StringIndexOutOfBoundsException when encountering invalid PostgreSQL unicode literal
3.20 Other improvements automation moved this from To do to Done Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant