-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add out of bounds check for encoding/decoding #42
Add out of bounds check for encoding/decoding #42
Conversation
c4fe3ae
to
c31559c
Compare
Thank you for your great work! I'll take a review this week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Comment left above.
aa4fd38
to
6942b30
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good to me! Just one comment.
include/protopuf/coder_mode.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow the abstraction over "mode" looks great!
6942b30
to
426473d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for your contribution!
Added the ability to select the encoding/decoding mode. If the safe mode is selected, then the buffer is checked for going beyond the boundaries. In this mode, the result is wrapped in std::optional.
In the unsafe mode (which is selected by default), no checks are performed. The encoding result is similar to what it was before the changes.
The decoding result is almost compatible with what it was before the changes (when assigning the result to a variable with the type 'auto', nothing in the old code will need to be changed).
Also the code is prepared for compilation with the flags -Wall -Werror -Wextra -Wconversion -pedantic.