Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane32 committed Jan 22, 2024
1 parent edfb7bd commit b468128
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Transports.AspNetCore/GraphQLHttpMiddleware.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma warning disable CA1716 // Identifiers should not match keywords

using System.Collections;
using System.ComponentModel.Design.Serialization;

Check failure on line 4 in src/Transports.AspNetCore/GraphQLHttpMiddleware.cs

View workflow job for this annotation

GitHub Actions / format

Using directive is unnecessary.

Check failure on line 4 in src/Transports.AspNetCore/GraphQLHttpMiddleware.cs

View workflow job for this annotation

GitHub Actions / format

Using directive is unnecessary.

Check failure on line 4 in src/Transports.AspNetCore/GraphQLHttpMiddleware.cs

View workflow job for this annotation

GitHub Actions / format

Using directive is unnecessary.

Check failure on line 4 in src/Transports.AspNetCore/GraphQLHttpMiddleware.cs

View workflow job for this annotation

GitHub Actions / format

Using directive is unnecessary.

Check failure on line 4 in src/Transports.AspNetCore/GraphQLHttpMiddleware.cs

View workflow job for this annotation

GitHub Actions / format

Using directive is unnecessary.
using System.Globalization;
using System.Text;
using Microsoft.AspNetCore.Authentication;
Expand Down Expand Up @@ -414,7 +415,7 @@ static void ApplyFileToRequest(IFormFile file, string target, GraphQLRequest? re
// Parse the index, ensure it is within bounds, and get the child object.
if (!int.TryParse(prop, NumberStyles.Integer, CultureInfo.InvariantCulture, out var index))
throw new InvalidMapError($"Child index '{prop}' is not an integer.");
if (list.Count < (index + 1))
if (list.Count < (index + 1) || index < 0)
throw new InvalidMapError($"Index '{index}' is out of bounds.");
parent = list[index] ?? throw new InvalidMapError($"Child index '{index}' refers to a null object.");
}
Expand Down Expand Up @@ -448,7 +449,7 @@ static void ApplyFileToRequest(IFormFile file, string target, GraphQLRequest? re
// Parse the index, ensure it is within bounds, and set the child object.
if (!int.TryParse(prop, NumberStyles.Integer, CultureInfo.InvariantCulture, out var index))
throw new InvalidMapError($"Child index '{prop}' is not an integer.");
if (list2.Count < (index + 1))
if (list2.Count < (index + 1) || index < 0)
throw new InvalidMapError($"Index '{index}' is out of bounds.");
if (list2[index] != null)
throw new InvalidMapError($"Index '{index}' must refer to a null variable.");
Expand Down

0 comments on commit b468128

Please sign in to comment.