github-advanced-security[bot] commented on code in PR #3388:
URL: https://github.com/apache/avro/pull/3388#discussion_r2109039210


##########
lang/csharp/src/apache/main/Specific/SpecificDatumWriter.cs:
##########
@@ -139,7 +139,7 @@
                     return obj is ISpecificRecord &&
                            ((obj as ISpecificRecord).Schema as 
RecordSchema).SchemaName.Equals((sc as RecordSchema).SchemaName);
                 case Schema.Type.Enumeration:
-                    return obj.GetType().IsEnum && (sc as 
EnumSchema).Symbols.Contains(obj.ToString());
+                    return obj.GetType().IsEnum && (sc as 
EnumSchema).Symbols.Contains(obj.ToString()) && 
sc.Name.Equals(obj.GetType().Name);

Review Comment:
   ## Dereferenced variable may be null
   
   Variable [obj](1) may be null at this access as suggested by [this](2) null 
check.
   Variable [obj](1) may be null at this access as suggested by [this](3) null 
check.
   
   [Show more 
details](https://github.com/apache/avro/security/code-scanning/3328)



##########
lang/csharp/src/apache/main/Specific/SpecificWriter.cs:
##########
@@ -209,7 +209,7 @@
                     return obj is ISpecificRecord &&
                            ((obj as ISpecificRecord).Schema as 
RecordSchema).SchemaName.Equals((sc as RecordSchema).SchemaName);
                 case Schema.Type.Enumeration:
-                    return obj.GetType().IsEnum && (sc as 
EnumSchema).Symbols.Contains(obj.ToString());
+                    return obj.GetType().IsEnum && (sc as 
EnumSchema).Symbols.Contains(obj.ToString()) && 
sc.Name.Equals(obj.GetType().Name);

Review Comment:
   ## Dereferenced variable may be null
   
   Variable [obj](1) may be null at this access as suggested by [this](2) null 
check.
   Variable [obj](1) may be null at this access as suggested by [this](3) null 
check.
   
   [Show more 
details](https://github.com/apache/avro/security/code-scanning/3329)



-- 
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]

Reply via email to