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

Make sure negative long numbers do not crash LogRecordStreamReader#962

Open
vadimm wants to merge 1 commit into
Azure:devfrom
vadimm:dev
Open

Make sure negative long numbers do not crash LogRecordStreamReader#962
vadimm wants to merge 1 commit into
Azure:devfrom
vadimm:dev

Conversation

@vadimm

@vadimm vadimm commented Jan 16, 2020

Copy link
Copy Markdown

No description provided.

else
{
return long.Parse(temp, NumberStyles.None, CultureInfo.InvariantCulture);
return Math.Max(0, long.Parse(temp, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture));

Copy link
Copy Markdown
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);

Copy link
Copy Markdown

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