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

Debug.Asserts don't detect protocol violations reliably #199

Closed
TimLovellSmith opened this issue Mar 29, 2024 · 1 comment · Fixed by #332
Closed

Debug.Asserts don't detect protocol violations reliably #199

TimLovellSmith opened this issue Mar 29, 2024 · 1 comment · Fixed by #332
Assignees
Labels
enhancement New feature or request parser

Comments

@TimLovellSmith
Copy link
Member

There are various checks in the fast parsing code implemented as debug asserts. I think unfortunately, if the assert is optimized away, it becomes garbage-in-garbage-out, instead of catching a protocol violation from the client.

            while (*ptr != '\r')
            {
                Debug.Assert(*ptr >= '0' && *ptr <= '9');
                number = number * 10 + *ptr++ - '0';
                if (ptr >= end)
                    return false;
            }
@TimLovellSmith TimLovellSmith changed the title Debug.Asserts don't detect protocol violation Debug.Asserts don't detect protocol violations reliably Mar 29, 2024
@badrishc
Copy link
Contributor

Yes, this is a known limitation of the current code which was optimized for performance. We are looking into adding back some of the checks in Release mode.

@TalZaccai TalZaccai added the enhancement New feature or request label Apr 1, 2024
@lmaas lmaas linked a pull request Apr 26, 2024 that will close this issue
@lmaas lmaas closed this as completed in #332 May 2, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants