-
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
Improve error checking in the command encoder. #1913
Improve error checking in the command encoder. #1913
Conversation
f8a9f8c
to
81d9fbe
Compare
81d9fbe
to
7565683
Compare
{ | ||
return size; | ||
} | ||
#define TRY_WRITE(dataItem) \ |
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.
Do we have a generic method for interfacing with buffers? Having proper methods for interfacing with buffers may be a better solution than a locally defined macro
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.
I haven't found one so far, but if we do, I'm happy to use it.
Note that this stuff is all still throwaway code pending whatever our real encoder will be; I really needed the "measure the size" aspect now, and adding it this way was simpler than keeping the existing structure of the code and adding lots of null-checks on buffer
...
Also note that there is more work to be done here, e.g. to fix #1632
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.
something that works on top of PacketBuffer would be welcome. something that has a "measure" form would be ideal.
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.
I've just added BufBound, which might help here
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.
We'd need to switch this file to C++ to use that. Which might be fine as long as we keep the entrypoint APIs extern C.... I can rebase on top of your change once it lands as desired, and make that modification.
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.
ah, yeah. I was thinking that we probably want to just make all these files C++ and fix any void* stuff
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.
Yeah, #1629 tracks the void*
bits.
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.
#2073 now tracks using BufBound
here.
7565683
to
fa5dcc1
Compare
There are actually two changes here: 1) Improve the error checking so that we correctly check that the buffer actually has enough space when writing a multibyte value. 2) Introduce a way to ask the encoder how much space it needs to encode a given APS frame. Fixes project-chip#1644
fa5dcc1
to
8ef4108
Compare
Size increase report for "gn_nrf-example-build"
Full report output
|
Size increase report for "gn_linux-example-build"
Full report output
|
Size increase report for "nrf-example-build"
Full report output
|
Size increase report for "nrfconnect-example-build"
Full report output
|
Size increase report for "linux-example-build"
Full report output
|
Size increase report for "esp32-example-build"
Full report output
|
…dio after creating a solution Merge in WMN_TOOLS/matter from feature/solutions_seq_templates to silabs_slc_1.3 Squashed commit of the following: commit 806440fda12d0a727f41efe549ebfa771be9619a Author: Sarthak Shaha <[email protected]> Date: Tue May 28 15:06:53 2024 -0400 rebase commit 97b7b05729b7aa7cf2ffd3f5c108d1829433aab9 Author: Sarthak Shaha <[email protected]> Date: Tue May 28 13:47:10 2024 -0400 fix to show project.slcp first in studio after creating a solution
There are actually two changes here:
Improve the error checking so that we correctly check that the
buffer actually has enough space when writing a multibyte value.
Introduce a way to ask the encoder how much space it needs to
encode a given APS frame.
Fixes #1644
Problem
The error checking in the command encoder doesn't work correctly when encoding multibyte values
Summary of Changes
Fix the error checking to correctly check that we have enough space.