[
https://issues.apache.org/jira/browse/AVRO-1561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15058046#comment-15058046
]
Martin Kleppmann commented on AVRO-1561:
----------------------------------------
[~virtuald]: Thanks for the patch, and sorry that this has been ignored for so
long. It looks important, but I'm only just starting to work my way into the
resolver code, so I'm not the best person to review it. Perhaps [~dcreager]
could comment?
It would be helpful if you could update the patch to make the whitespace
consistent with surrounding code (you're using spaces, the rest of the code
uses tabs), and provide a test case that can be run automatically on build.
That hopefully wouldn't be hard to construct from your example avsc. Thanks!
> [PATCH] segfault NPE in avro_resolved_map_reader_get_by_index
> -------------------------------------------------------------
>
> Key: AVRO-1561
> URL: https://issues.apache.org/jira/browse/AVRO-1561
> Project: Avro
> Issue Type: Bug
> Components: c
> Affects Versions: 1.7.7
> Reporter: Dustin Spicuzza
> Priority: Critical
> Attachments: map_npe.patch
>
>
> This one took a long time to diagnose, but this bug only appears to happen
> when you have a map with an embedded record, provided that the record was
> previously there. Here's an example avsc that triggers the bug:
> {noformat}
> {
> "type" : "record",
> "name" : "ObjectWithMap",
> "namespace" : "foobar",
> "fields" : [ {
> "name" : "nested",
> "type" : {
> "type" : "record",
> "name" : "Nested",
> "fields" : [ {
> "name" : "something",
> "type" : "int"
> } ]
> }
> }, {
> "name" : "mapOfObjects",
> "type" : {
> "type" : "map",
> "values" : "Nested"
> }
> } ]
> }
> {noformat}
> The reason the bug occurs in this specific instance is because the schema
> causes the two Nested objects to be link records, and so a link resolver is
> set in the iface for the value, but it's never initialized.
> The patch copies the initialization code present in
> avro_resolved_array_reader_get_by_index into
> avro_resolved_map_reader_get_by_index and
> avro_resolved_map_reader_get_by_name, and the segfault no longer occurs.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)