Dustin Spicuzza created AVRO-1561:
-------------------------------------
Summary: [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
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.2#6252)