[
https://issues.apache.org/jira/browse/AVRO-2122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16309711#comment-16309711
]
ASF GitHub Bot commented on AVRO-2122:
--------------------------------------
GitHub user brtm opened a pull request:
https://github.com/apache/avro/pull/276
AVRO-2122 track which symbols have been visited to avoid StackOverflo…
…wErrors when validating schemas with recursive definitions
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/brtm/avro branch-1.8
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/avro/pull/276.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #276
----
commit 40f597f6f100a412687d8bc251bcaa38359c6165
Author: Bart <brtm@...>
Date: 2018-01-03T14:03:57Z
AVRO-2122 track which symbols have been visited to avoid
StackOverflowErrors when validating schemas with recursive definitions
----
> Cannot validate schemas with recursive definitions
> --------------------------------------------------
>
> Key: AVRO-2122
> URL: https://issues.apache.org/jira/browse/AVRO-2122
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.8.2
> Reporter: Bart
>
> Validating a schema with a recursive definition will lead to a stack
> overflow. When using the following schema definition:
> {noformat}
> @namespace("avro")
> protocol Unused {
> record Node {
> union { null, Node } value = null;
> }
> }
> {noformat}
> {code:java}
> final SchemaValidator backwardValidator = new SchemaValidatorBuilder()
> .canReadStrategy().validateLatest();
> backwardValidator.validate(Node.SCHEMA$, Arrays.asList(Node.SCHEMA$));
> {code}
> It results in a stack trace:
> {noformat}
> java.lang.StackOverflowError
> at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:406)
> at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:392)
> at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:383)
> at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:406)
> at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:392)
> at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:406)
> at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:374)
> at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:406)
> ...
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)