Repository navigation
inspector: fix ctype UB, stoi overflow, WebSocket frame bounds - #65763
VirajMishra1 wants to merge 1 commit into
Conversation
|
Review requested:
|
|
Caution AgentScan found account activity patterns that may be consistent with |
61336d0 to
ce98e53
Compare
|
Please make sure you have read and understood the following documents: |
|
I have read and understood all of the linked documents -- the contributing guide, pull request guide, AI use policy, automation policy, and Code of Conduct. To be transparent: I used AI tooling to help identify these bugs and draft the initial code, but I personally reviewed each change, understand what it does, and take responsibility for it. I did not use automated tooling to open this PR -- I opened it manually after reviewing the diff. Happy to discuss any of the specific changes if that would help. |
ce98e53 to
ab3faa4
Compare
This comment was marked as resolved.
This comment was marked as resolved.
669354e to
9d651d8
Compare
|
Thanks for checking. Two CI failures, both now fixed:
Force-pushed the updated commit. CI should be clean now. |
9d651d8 to
3783f45
Compare
|
|
||
| const headersMap = this[kOutHeaders]; | ||
| const headers = {}; | ||
| const headers = { __proto__: null }; |
There was a problem hiding this comment.
this alone would likely need a full http CI benchmark
There was a problem hiding this comment.
I reverted it for now, happy to revisit in a separate PR with benchmarks.
- inspector_io.cc: cast isdigit arg to unsigned char (signed UB) - inspector_io.cc: replace stoi with from_chars (no-exceptions build) - inspector_io.cc: cast to unsigned int before left-shift (UB) - inspector_socket.cc: fix WebSocket frame bounds check Signed-off-by: VirajMishra1 <viraj.mishra.81@gmail.com>
3783f45 to
87a5ab0
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #65763 +/- ##
==========================================
+ Coverage 89.95% 90.05% +0.09%
==========================================
Files 757 769 +12
Lines 258053 261322 +3269
Branches 48934 49631 +697
==========================================
+ Hits 232144 235336 +3192
- Misses 16962 17035 +73
- Partials 8947 8951 +4
🚀 New features to boost your workflow:
|
|
Thanks for flagging this. The mismatch was from before I replaced |
Fixes four small issues in the inspector:
inspector_io.cc: the::isdigitcall now takes anunsigned char. Passing a plaincharis undefined behavior when the value is negative, which happens with non-ASCII input.inspector_io.cc:std::stoiis replaced withstd::from_chars. The string is already checked to be all digits, so the only difference is overflow:stoithrows, which doesn't build with-fno-exceptions, andfrom_charsreports an error code that we now check.inspector_io.cc:target_session_idis cast tounsigned intbefore the<< 16, since left-shifting a negative or large signed value is undefined behavior.inspector_socket.cc: indecode_frame_hybi17the length check compared the payload length against the size of the whole buffer. At that point the frame header has already been consumed, so it now compares against the bytes remaining after the iterator. That stops a frame whose declared length is larger than what is actually left from being treated as complete.I used AI tooling to help find these and draft the first version. I reviewed and understand each change and I am responsible for it.