-
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 for a potential inifite loop in PrepareToReadVendorReservedElements #18560
Fix for a potential inifite loop in PrepareToReadVendorReservedElements #18560
Conversation
@robszewczyk how hard would it be to add a unit test that fails before this change but passes after it, so that this never regresses? |
PR #18560: Size comparison from 02d8302 to 30182d4 Increases (1 build for linux)
Full report (27 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
|
@andy31415 -- it looks like adding a unit test is relatively straightforward, working on that now. Please do not merge until I've had a chance to add the test |
30182d4
to
a416fbd
Compare
@andy31415 unit test added, loops without the fix. |
PR #18560: Size comparison from 3a7cbf8 to a416fbd Increases (4 builds for linux)
Full report (29 builds for cyw30739, efr32, k32w, linux, mbed, nrfconnect, p6, telink)
|
When scanning up through the elements in search of a Vendor Reserved element, `PrepareToReadVendorReser` would call `mTlvReader.Next()` inside a `while (true)` loop. Should the `TLVReader::Next()` return an error other than `END_OF_TLV` the loop reader would neither advance nor exit the loop. The change exits the function on any way in a way that parallels the earlier error checks on TLVReader errors.
a416fbd
to
9f6ec3e
Compare
PR #18560: Size comparison from ad0f7b8 to 9f6ec3e Increases (4 builds for linux)
Full report (31 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
|
Problem
When scanning up through the elements in search of a Vendor Reserved
element,
PrepareToReadVendorReser
would callmTlvReader.Next()
inside a
while (true)
loop. Should theTLVReader::Next()
returnan error other than
END_OF_TLV
the loop reader would neither advancenor exit the loop.
Change overview
The change exits the function on any way in a way
that parallels the earlier error checks on TLVReader errors.
Testing
All existing unit tests pass as before. No new unit test was provided for this case.