-
Notifications
You must be signed in to change notification settings - Fork 127
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 infinite loop when the buffer ends with \r #123
Open
vvigilante
wants to merge
2
commits into
fhessel:master
Choose a base branch
from
vvigilante:fix/readline_inf_loop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
This was referenced Apr 19, 2021
amandel
added a commit
to openbikesensor/OpenBikeSensorFirmware
that referenced
this pull request
Jun 12, 2021
…ssel/esp32_https_server#123 This causes the http server to stop responding.
khoih-prog
added a commit
to khoih-prog/ESP32_HTTPS_Server
that referenced
this pull request
Sep 27, 2022
Merge some upstream PRs - Handling of errors - like unstable network - coming via SSL fhessel#89 - WIP: Prevent crash on WebSocket request to non-WebSocket node. fhessel#106 - Fix infinite loop when the buffer ends with \r fhessel#123 - Fixed memory leak in the Websocket example fhessel#157
This was referenced Sep 27, 2022
Closed
khoih-prog
added a commit
to khoih-prog/ESP32_HTTPS_Server
that referenced
this pull request
Sep 27, 2022
1. Merge some upstream PRs - Handling of errors - like unstable network - coming via SSL fhessel#89 - WIP: Prevent crash on WebSocket request to non-WebSocket node. fhessel#106 - Fix infinite loop when the buffer ends with \r fhessel#123 - Fixed memory leak in the Websocket example fhessel#157 2. Update examples and `README.md`
khoih-prog
added a commit
to khoih-prog/ESP32_HTTPS_Server
that referenced
this pull request
Sep 27, 2022
1. Merge some upstream PRs - Handling of errors - like unstable network - coming via SSL fhessel#89 - WIP: Prevent crash on WebSocket request to non-WebSocket node. fhessel#106 - Fix infinite loop when the buffer ends with \r fhessel#123 - Fixed memory leak in the Websocket example fhessel#157 2. Update examples and `README.md`
khoih-prog
added a commit
to khoih-prog/ESP32_HTTPS_Server
that referenced
this pull request
Sep 27, 2022
1. Merge some upstream PRs - Handling of errors - like unstable network - coming via SSL fhessel#89 - WIP: Prevent crash on WebSocket request to non-WebSocket node. fhessel#106 - Fix infinite loop when the buffer ends with \r fhessel#123 - Fixed memory leak in the Websocket example fhessel#157 2. Update examples and `README.md`
This was referenced Aug 18, 2023
gb-123-git
added a commit
to gb-123-git/esp32_https_server
that referenced
this pull request
Aug 18, 2023
* Fix infinite loop when the buffer ends with \r * Properly check for end of line across buffers --------- Co-authored-by: vvigilante <[email protected]>
gb-123-git
added a commit
to gb-123-git/esp32_https_server
that referenced
this pull request
Aug 18, 2023
* Fix infinite loop when the buffer ends with \r * Properly check for end of line across buffers --------- Co-authored-by: vvigilante <[email protected]>
hakuamesan
added a commit
to hakuamesan/esp32_https_server
that referenced
this pull request
Sep 1, 2023
gb-123-git
added a commit
to gb-123-git/esp32_https_server
that referenced
this pull request
Nov 1, 2023
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.
HTTPConnection::readLine
has an infinite loop condition, when\r
is the last character on the buffer,_bufferProcessed
never gets updated, so the exit condition for the loop is never met.With the modification in the first commit, the
\r
character gets accounted on its own and the buffer can be refreshed.The downside is that the
\n
character will be considered on its own on the next iteration, and added to the_pareserLine.text
rather than being grouped with\r
and being counted as line terminator.In the second commit, we keep track of the partial termination using a member variable, so as to detect the
\r\n
pair even when it happens across two different buffers, so that every problem with the first commit is resolved.