Skip to content

Fix remaining null-to-empty-CefString CHECK() crash sites (#19/#20/#21) - #49

Merged
Thrameos merged 1 commit into
masterfrom
backport/null-string-check-crash-guards
Sep 6, 2026
Merged

Thrameos merged 1 commit into
masterfrom
backport/null-string-check-crash-guards

Conversation

@Thrameos

@Thrameos Thrameos commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

Test plan

  • Full clean rebuild (native ninja -C jcef_build jcef + tools/compile.sh linux64)
  • NullParameterEdgeCaseTest (18 tests, including the 4 new ones) run together with CefDownloadItemTest in the same JVM: 18/18 pass
  • Confirmed a run-in-isolation crash seen while investigating (CefRequest_0_CppToC called with invalid version -1) reproduces identically on an untouched, unrelated pre-existing test method too -- it's NullParameterEdgeCaseTest's own documented pre-existing limitation (per TestSetupExtension's comments: tests that never create a browser rely on an earlier browser-creating test in the same JVM run to bring CEF's browser-process fully up), not something this change introduces
  • CI (build/test/coverage jobs)

🤖 Generated with Claude Code

https://claude.ai/code/session_01HBFmQs6JDypYP5qdC99yDq

PR #43 already guarded CefRequest_N.cpp's SetURL and SetHeaderByName's
name param against a non-null-but-empty Java String reaching CEF's
internal CHECK(!x.empty()) (a hard abort in a Debug/coverage build,
silently permitted in Release since CEF's own generated ctocpp wrapper
no-ops on empty right after the CHECK -- which never runs, because CHECK
aborts first). This is the same bug's remaining call sites, all of which
already had a null-Java-string guard but not the empty-string one:
CefPostDataElement_N.cpp's SetToFile, CefRequest_N.cpp's SetMethod and
Set(), and CefResponse_N.cpp's SetHeaderByName.

Backport of coverage/phase1-value-objects-phase2-handlers' 92aed53,
adapted to this branch's existing null-guard structure rather than a
literal cherry-pick (that commit predates PR #43's null-vs-empty split
for SetURL/SetHeaderByName).

Adds four regression tests to the existing NullParameterEdgeCaseTest.java
(no separate test file, since master doesn't yet have PR #43's
MalformedInputEdgeCaseTest.java where the future branch's own equivalent
tests would otherwise belong).

Verified: full rebuild (native + Java), 18/18 tests pass running
NullParameterEdgeCaseTest together with CefDownloadItemTest in the same
JVM (NullParameterEdgeCaseTest creates CEF objects without ever creating
a browser, and per TestSetupExtension's own documented design only
reaches CEF's fully-initialized browser-process state once some test in
the same run has created one -- confirmed this is a pre-existing
run-in-isolation limitation of that test file, not something this change
introduces, by reproducing the same crash on an untouched pre-existing
test method with no relation to this fix).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HBFmQs6JDypYP5qdC99yDq
@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 38.20%. Comparing base (be68fe1) to head (00b077f).

Files with missing lines Patch % Lines
native/CefRequest_N.cpp 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #49      +/-   ##
============================================
+ Coverage     38.01%   38.20%   +0.18%     
- Complexity      735      741       +6     
============================================
  Files           243      243              
  Lines         14863    14889      +26     
  Branches       2449     2453       +4     
============================================
+ Hits           5650     5688      +38     
+ Misses         8011     7995      -16     
- Partials       1202     1206       +4     

☔ 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.

@Thrameos Thrameos added the bug Something isn't working label Sep 6, 2026
@Thrameos
Thrameos merged commit f56d33c into master Sep 6, 2026
9 checks passed
@Thrameos
Thrameos deleted the backport/null-string-check-crash-guards branch September 6, 2026 03:06
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