You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2018/12/11 19:15:01 UTC

[jira] [Commented] (AVRO-2122) Cannot validate schemas with recursive definitions

    [ https://issues.apache.org/jira/browse/AVRO-2122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16717788#comment-16717788 ] 

ASF subversion and git services commented on AVRO-2122:
-------------------------------------------------------

Commit 49471412e5a10ff7b4f2806a1af03372d12b7945 in avro's branch refs/heads/branch-1.8 from Bart
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=4947141 ]

AVRO-2122: Cannot validate schemas with recursive definitions

Track which symbols have been visited to avoid StackOverflowErrors
when validating schemas with recursive definitions

This closes #276

Signed-off-by: Nandor Kollar <nk...@apache.org>

(cherry picked from commit 7f9cbca12af13d4b8b5709edba2bae4d4a808102)


> Cannot validate schemas with recursive definitions
> --------------------------------------------------
>
>                 Key: AVRO-2122
>                 URL: https://issues.apache.org/jira/browse/AVRO-2122
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.8.2
>            Reporter: Bart
>            Assignee: Bart
>            Priority: Major
>             Fix For: 1.7.8, 1.9.0, 1.8.3
>
>
> 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
(v7.6.3#76005)