Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Inf and NaN regex when using WithAttemptingUnquotedStringTypeDeserialization #730

Merged
merged 2 commits into from Oct 7, 2022

Conversation

lkillgore
Copy link

Fixes #729.

Deserializing .INF and .NAN using WithAttemptingUnquotedStringTypeDeserialization

@@ -381,7 +381,7 @@ private static object CastInteger(ulong number, TypeCode typeCode)
result = v;
}
}
else if (Regex.IsMatch(v, @"[-+]?(\.inf|\.Inf|\.INF)")) //infinities
else if (Regex.IsMatch(v, @"^[-+]?(\.inf|\.Inf|\.INF)$")) //infinities
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't allow for whitespace before or after, but I am guessing the string is trimmed long before it gets here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In all my testing it's trimmed, but I don't know the code well enough to know if that's a guarantee.

@jpricket
Copy link

jpricket commented Oct 4, 2022

These changes make sense to me. One small comment.

@stan-sz
Copy link
Contributor

stan-sz commented Oct 6, 2022

/assign @EdwardCooke

@edwardcookemacu
Copy link

@jpricket @lkillgore The build failed so I can't merge this in. I'll try and look into it tonight. It may have been a fluke and just need to be requeued. When I get it merged in, I'll cut a new release.

@lkillgore
Copy link
Author

Thanks, @edwardcookemacu! I looked at the build failure, and it looks like it's the same one in this PR, which appears to be a transient failure AFAICT.

@aaubry
Copy link
Owner

aaubry commented Oct 6, 2022

Thanks, @edwardcookemacu! I looked at the build failure, and it looks like it's the same one in this PR, which appears to be a transient failure AFAICT.

This seems to be an issue with GitVersion. Sometimes it happens, but I've never been able to figure out why it happens. It's not easy to debug because locally it's difficult to reproduce and GitVersion is very fragile.

@EdwardCooke EdwardCooke merged commit 8821b7f into aaubry:master Oct 7, 2022
@aaubry
Copy link
Owner

aaubry commented Oct 7, 2022

This feature has been released in version 12.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Strings with '.inf' in them being read as Infinity
6 participants