Skip to content

Add unit test for ChannelPutData#943

Open
yosuke-wolfssl wants to merge 1 commit intowolfSSL:masterfrom
yosuke-wolfssl:f_2487
Open

Add unit test for ChannelPutData#943
yosuke-wolfssl wants to merge 1 commit intowolfSSL:masterfrom
yosuke-wolfssl:f_2487

Conversation

@yosuke-wolfssl
Copy link
Copy Markdown
Contributor

This PR adds a unit test that creates a channel with a small windowSz (e.g., 100 bytes), then calls ChannelPutData with a buffer larger than the window. Verify that WS_FATAL_ERROR is returned. Also verify that after consuming window with valid data, exceeding the remaining window is rejected.

@yosuke-wolfssl yosuke-wolfssl self-assigned this Apr 21, 2026
Copilot AI review requested due to automatic review settings April 21, 2026 06:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an internal unit test to validate SSH channel receive-window enforcement by ChannelPutData() (via a new wolfSSH_TestChannelPutData() test hook), ensuring oversized writes are rejected both initially and after partially consuming the window.

Changes:

  • Expose ChannelPutData() to internal unit tests via wolfSSH_TestChannelPutData() under WOLFSSH_TEST_INTERNAL.
  • Add test_ChannelPutData() to tests/unit.c to assert WS_FATAL_ERROR when input exceeds the channel window (including after window consumption).
  • Register the new unit test in the unit-test runner output.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
wolfssh/internal.h Declares new internal-test hook wolfSSH_TestChannelPutData() under WOLFSSH_TEST_INTERNAL.
src/internal.c Implements wolfSSH_TestChannelPutData() wrapper calling ChannelPutData().
tests/unit.c Adds and runs test_ChannelPutData() validating window enforcement and bad-argument handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yosuke-wolfssl
Copy link
Copy Markdown
Contributor Author

Hello @ejohnstown ,
I solved the merge conflict now.
Could you review this please ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants