AVRO-4270: [C] Fix wrong schema accessor in avro_generic_map_class#3823
Open
KyleKim107 wants to merge 1 commit into
Open
AVRO-4270: [C] Fix wrong schema accessor in avro_generic_map_class#3823KyleKim107 wants to merge 1 commit into
KyleKim107 wants to merge 1 commit into
Conversation
martin-g
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
avro_generic_map_class()inlang/c/src/generic.cincorrectly callsavro_schema_array_items(schema)instead ofavro_schema_map_values(schema).This is a copy-paste bug from the array class implementation.
The wrong accessor reinterprets a MAP schema pointer as an ARRAY schema type.
Under UndefinedBehaviorSanitizer with
-fno-sanitize-recover, this triggers afatal diagnostic when processing MAP schemas. Without sanitizers the code
silently returns the correct value today because
avro_array_schema_tandavro_map_schema_tshare the same memory layout, but this is fragile and willbreak if the struct layouts diverge.
This pull request fixes AVRO-4270.
Verifying this change
This change can be verified as follows:
-fsanitize=address,undefined -fno-sanitize-recover=undefined -g -O1value_reader_fuzzertargetingavro_value_read()with a PoCinput that selects a
{"type":"map","values":"string"}schemaDiscovered by FuzzingBrain @o2lab.
Documentation
no
not applicable