Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Make sure negative long numbers do not crash LogRecordStreamReader #962

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

vadimm
Copy link

@vadimm vadimm commented Jan 16, 2020

No description provided.

@@ -274,7 +274,7 @@ public void EndCurrentRecord()
}
else
{
return long.Parse(temp, NumberStyles.None, CultureInfo.InvariantCulture);
return Math.Max(0, long.Parse(temp, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture));
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we want to allow negative longs here?

Couldn't we do

return long.Parse(temp, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture);

Choose a reason for hiding this comment

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

Yes, this should also work. The only reason to avoid negatives is that previously the framework would throw an exception, so it might be a breaking change for customer.

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

Successfully merging this pull request may close these issues.

3 participants