-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 buffer overruns and endianness issues in decoder code. #2362
Merged
rwalker-apple
merged 1 commit into
project-chip:master
from
bzbarsky-apple:fix-decoder-endianness
Aug 27, 2020
Merged
Fix buffer overruns and endianness issues in decoder code. #2362
rwalker-apple
merged 1 commit into
project-chip:master
from
bzbarsky-apple:fix-decoder-endianness
Aug 27, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bzbarsky-apple
requested review from
andy31415,
anush-apple,
BroderickCarlin,
chrisdecenzo,
hawk248,
jelderton,
robszewczyk,
saurabhst and
woody-apple
as code owners
August 27, 2020 17:30
bzbarsky-apple
force-pushed
the
fix-decoder-endianness
branch
from
August 27, 2020 17:34
aaf4ab2
to
496173b
Compare
bzbarsky-apple
force-pushed
the
fix-decoder-endianness
branch
2 times, most recently
from
August 27, 2020 18:35
298b880
to
d925f0e
Compare
bzbarsky-apple
force-pushed
the
fix-decoder-endianness
branch
from
August 27, 2020 18:45
d925f0e
to
cabeff7
Compare
mspang
approved these changes
Aug 27, 2020
rwalker-apple
approved these changes
Aug 27, 2020
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
There are two issues being fixed here: 1) The code was checking that it had at least one more byte available to read, but then reading multiple bytes in some cases. 2) The code was reading the data (which is little-endian) via memcpy, which would not do the right thing on big-endian systems. The former problem is fixed by checking that we can read the number of bytes we plan to read; the latter problem is fixed by using ChipEncoding to read the data explicitly as little-endian data.
bzbarsky-apple
force-pushed
the
fix-decoder-endianness
branch
from
August 27, 2020 18:55
cabeff7
to
decc859
Compare
Size increase report for "nrfconnect-example-build"
Full report output
|
Size increase report for "esp32-example-build"
Full report output
|
Size increase report for "gn_nrf-example-build"
Full report output
|
Size increase report for "gn_linux-example-build"
Full report output
|
andy31415
approved these changes
Aug 27, 2020
saurabhst
approved these changes
Aug 27, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are two issues being fixed here:
The code was checking that it had at least one more byte available
to read, but then reading multiple bytes in some cases.
The code was reading the data (which is little-endian) via memcpy,
which would not do the right thing on big-endian systems.
The former problem is fixed by checking that we can read the number of
bytes we plan to read; the latter problem is fixed by using
ChipEncoding to read the data explicitly as little-endian data.
fixes #1632