Skip to content

Validate malformed JNI input in CefRequest/CefPostDataElement (#19, #20, partial #21) - #43

Merged
Thrameos merged 1 commit into
masterfrom
backport/malformed-input-jni-validation
Sep 6, 2026
Merged

Thrameos merged 1 commit into
masterfrom
backport/malformed-input-jni-validation

Conversation

@Thrameos

@Thrameos Thrameos commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

Ported from coverage/phase1-value-objects-phase2-handlers's 0af4a4e. master had no MalformedInputEdgeCaseTest, so this adds a fresh minimal file with just the three regression tests this fix covers.

Test plan

  • Native (ninja jcef) and Java (tools/compile.sh linux64) both build clean.
  • Local full-suite verification skipped this round -- the local dev VM is dealing with an unrelated, pre-existing GH Release build: SIGSEGV in libc.so.6 during JVM shutdown after all tests pass #10 shutdown crash that's currently reproducing very reliably on any browser-touching test; relying on this repo's CI (test job) to verify instead.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.09%. Comparing base (be68fe1) to head (b0f0957).

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #43      +/-   ##
============================================
+ Coverage     38.01%   38.09%   +0.08%     
- Complexity      735      741       +6     
============================================
  Files           243      244       +1     
  Lines         14863    14889      +26     
  Branches       2449     2452       +3     
============================================
+ Hits           5650     5672      +22     
- Misses         8011     8012       +1     
- Partials       1202     1205       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…#21)

- #19: N_SetToBytes passed a signed jint |size| straight into
  CefPostDataElement::SetToBytes()'s unsigned size_t parameter -- a
  negative size implicitly became a huge unsigned value, causing a
  silent buffer over-read/segfault with no diagnostic output. Reject
  size < 0 or size > the actual array length before calling into CEF.

- #20: N_SetHeaderByName already guarded a null Java header name, but
  a non-null empty string still reached CEF's own CHECK(!name.empty())
  (aborts Debug/coverage builds, silently permitted in Release). Reject
  an empty name too.

- #21 (partial): N_SetURL had the same gap -- guarded null, not empty.
  Reject an empty URL too. The second, distinct crash #21 describes
  (NOTREACHED reading back a URL that was setURL()'d with a
  malformed-but-non-empty string) is not addressed here and remains
  open.

Ported from coverage/phase1-value-objects-phase2-handlers's 0af4a4e;
master had no MalformedInputEdgeCaseTest, so added a fresh minimal file
with just the three regression tests this fix covers.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HBFmQs6JDypYP5qdC99yDq
@Thrameos
Thrameos force-pushed the backport/malformed-input-jni-validation branch from 79dcdc5 to b0f0957 Compare September 5, 2026 21:23
@Thrameos Thrameos added the bug Something isn't working label Sep 6, 2026
@Thrameos
Thrameos merged commit 0d188ae into master Sep 6, 2026
9 checks passed
@Thrameos
Thrameos deleted the backport/malformed-input-jni-validation branch September 6, 2026 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant