Copilot commented on code in PR #3889:
URL: https://github.com/apache/avro/pull/3889#discussion_r3612685349
##########
lang/c++/test/SchemaTests.cc:
##########
@@ -230,7 +230,17 @@ const char *basicSchemaErrors[] = {
// default double - null
R"({ "name":"test", "type": "record", "fields": [ {"name":
"double","type": "double","default" : null }]})",
// default double - string
- R"({ "name":"test", "type": "record", "fields": [ {"name":
"double","type": "double","default" : "string" }]})"
+ R"({ "name":"test", "type": "record", "fields": [ {"name":
"double","type": "double","default" : "string" }]})",
+
+ // Names outside the Avro name grammar
+ // Enum symbol containing a space
+ R"({"type": "enum", "name": "Status", "symbols" : ["Ok", "Not Ok"]})",
+ // Enum symbol attempting identifier injection
+ R"({"type": "enum", "name": "Status", "symbols" : ["Ok", "A, B_c = 5"]})",
+ // Field name containing a space
+ R"({"type":"record","name":"R","fields":[{"name":"in
valid","type":"long"}]})",
+ // Field name attempting identifier/code injection
+ R"({"type":"record","name":"R","fields":[{"name":"x; int
y","type":"long"}]})"
Review Comment:
The new negative test cases cover invalid characters, but they don’t
currently cover the newly enforced "non-empty" constraint (empty field names /
empty enum symbols). Adding explicit empty-name cases would lock in the
behavior validated by validateSimpleName().
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]