Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueNote Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 Summary
Priority: ➖ Normal Merge Risk: 🔵 Low · up to
|
4c16c24 to
ba5903b
Compare
There was a problem hiding this comment.
Actionable comments posted: 14
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository: Stirling-Tools/JPDFium/.coderabbit.yaml
- Review profile: ASSERTIVE
- Plan: Advanced
- Run ID:
9f3402db-0fd8-4474-bdf5-abe9a841e39e
📒 Files selected for processing (99)
.github/scripts/check-native-symbols.sh.github/workflows/corpus.yml.gitignoreNOTICEdocs/concurrency.mddocs/configuration.mddocs/design/DESIGN.mddocs/design/JAVA_MIGRATION.mddocs/design/JAVA_MIGRATION_INVENTORY.mdjpdfium/build.gradle.ktsjpdfium/src/jmh/java/stirling/software/jpdfium/bench/PdfiumDomainBenchmark.javajpdfium/src/main/java/stirling/software/jpdfium/panama/FastLinks.javajpdfium/src/main/java/stirling/software/jpdfium/panama/FontLib.javajpdfium/src/main/java/stirling/software/jpdfium/panama/JpdfiumH.javajpdfium/src/main/java/stirling/software/jpdfium/panama/JpdfiumLib.javajpdfium/src/main/java/stirling/software/jpdfium/panama/NativeDomain.javajpdfium/src/main/java/stirling/software/jpdfium/panama/PdfiumRuntime.javajpdfium/src/main/java/stirling/software/jpdfium/panama/Symbols.javajpdfium/src/main/resources/META-INF/native-image/com.stirling/jpdfium/reachability-metadata.jsonjpdfium/src/test/java/stirling/software/jpdfium/LifecycleTest.javajpdfium/src/test/java/stirling/software/jpdfium/panama/AbiHandshakeTest.javajpdfium/src/test/java/stirling/software/jpdfium/panama/DomainConsistencyTest.javajpdfium/src/test/java/stirling/software/jpdfium/panama/DomainEntryStackTest.javajpdfium/src/test/java/stirling/software/jpdfium/panama/DomainLeakTest.javajpdfium/src/test/java/stirling/software/jpdfium/panama/FastLinkFallbackTest.javajpdfium/src/test/java/stirling/software/jpdfium/panama/NestedTeardownContextTest.javajpdfium/src/test/java/stirling/software/jpdfium/panama/PdfiumRuntimeTest.javajpdfium/src/test/java/stirling/software/jpdfium/panama/RuntimeShutdownTest.javanative/CMakeLists.txtnative/bridge/include/jpdfium.hnative/bridge/include/jpdfium_api.hnative/bridge/include/jpdfium_core.hnative/bridge/include/jpdfium_internal.hnative/bridge/src/images/api_bitmap.cppnative/bridge/src/images/pixels.cppnative/bridge/src/images/pixels.hnative/bridge/src/jpdfium_document.cppnative/bridge/src/jpdfium_render.cppnative/bridge/src/legacy/guards_bridge.cppnative/bridge/src/legacy/guards_pdfium.cppnative/bridge/src/objects/module_objects.hnative/bridge/src/objects/object_table.hnative/bridge/src/objects/objects.cppnative/bridge/src/objects/objects.hnative/bridge/src/output/image_writer.cppnative/bridge/src/output/image_writer.hnative/bridge/src/output/output_transaction.cppnative/bridge/src/output/output_transaction.hnative/bridge/src/pdf/api_document.cppnative/bridge/src/pdf/api_raster.cppnative/bridge/src/pdf/api_render.cppnative/bridge/src/pdf/api_text.cppnative/bridge/src/runtime/api_module.cppnative/bridge/src/runtime/api_runtime.cppnative/bridge/src/runtime/api_status.cppnative/bridge/src/runtime/api_status.hnative/bridge/src/runtime/domain.cppnative/bridge/src/runtime/domain.hnative/bridge/src/runtime/guard.cppnative/bridge/src/runtime/guard.hnative/bridge/src/runtime/pdfium_core_stub.cppnative/bridge/src/textlayer/api_text_layer.cppnative/bridge/src/textlayer/text_layer.cppnative/bridge/src/textlayer/text_layer.hnative/bridge/tests/api_guards.cppnative/bridge/tests/api_image.cppnative/bridge/tests/api_object_table.cppnative/bridge/tests/api_raster.cppnative/bridge/tests/api_safety.cppnative/bridge/tests/api_text_layer.cppnative/build-real.shnative/licenses/CLIPPER-BSL-1.0.txtnative/ocr/fetch-onnxruntime.shnative/ocr/include/jpdfium_ocr.hnative/ocr/onnxruntime.versionnative/ocr/profiles/pp-ocrv6-small-balanced.profilenative/ocr/profiles/pp-ocrv6-small.profilenative/ocr/src/api_ocr.cppnative/ocr/src/cv_compat.cppnative/ocr/src/cv_compat.hnative/ocr/src/engine.cppnative/ocr/src/engine.hnative/ocr/src/ort_session.cppnative/ocr/src/ort_session.hnative/ocr/src/paddle.cppnative/ocr/src/paddle.hnative/ocr/src/profile.cppnative/ocr/src/sha256.cppnative/ocr/tests/lsan.suppnative/ocr/tests/make_golden.pynative/ocr/tests/ocr_engine.cppnative/ocr/tests/ocr_geometry.cppnative/ocr/tests/ocr_golden.incnative/ocr/tests/tsan.suppnative/ocr/tools/fetch_profile.pynative/rust/jpdfium-impl/Cargo.tomlnative/rust/jpdfium-impl/src/lib.rsnative/tools/downcall_inventory.pynative/tools/gen_guards.py
💤 Files with no reviewable changes (3)
- jpdfium/src/test/java/stirling/software/jpdfium/panama/DomainEntryStackTest.java
- jpdfium/src/test/java/stirling/software/jpdfium/panama/DomainLeakTest.java
- jpdfium/src/test/java/stirling/software/jpdfium/panama/NestedTeardownContextTest.java
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
📜 Review details
⏰ Context from checks skipped due to timeout. (13)
- GitHub Check: build-natives (darwin-x64, macos-15-intel)
- GitHub Check: build-natives (linux-x64, ubuntu-latest)
- GitHub Check: build-natives (windows-x64, windows-latest)
- GitHub Check: build-natives (windows-arm64, windows-11-arm)
- GitHub Check: build-natives (darwin-arm64, macos-14)
- GitHub Check: build-natives (linux-arm64, ubuntu-24.04-arm)
- GitHub Check: Corpus tests (shard 1/4)
- GitHub Check: Corpus tests (shard 0/4)
- GitHub Check: Corpus tests (shard 3/4)
- GitHub Check: Corpus tests (shard 2/4)
- GitHub Check: Native bridge libFuzzer (ASan/UBSan, real PDFium)
- GitHub Check: CLI correctness & no-corruption tests
- GitHub Check: JMH Benchmarks (FFM Downcall Overhead Gate)
🧰 Additional context used
📚 Code guidelines (1)
.github/CODERABBIT_REVIEW.md — configured
📓 Path-based instructions (5)
Apply the native ownership, C ABI, C++23, engine integration, memory, and SIMD rules from .github/CODERABBIT_REVIEW.md.
⚙️ CodeRabbit configuration file
Files:
native/bridge/include/jpdfium_internal.hnative/bridge/src/jpdfium_render.cppnative/bridge/src/objects/objects.cppnative/bridge/src/textlayer/api_text_layer.cppnative/bridge/src/objects/module_objects.hnative/bridge/src/runtime/guard.hnative/ocr/src/sha256.cppnative/bridge/src/runtime/pdfium_core_stub.cppnative/ocr/tests/ocr_geometry.cppnative/bridge/include/jpdfium_core.hnative/bridge/src/output/output_transaction.hnative/bridge/src/runtime/guard.cppnative/ocr/src/engine.cppnative/bridge/tests/api_raster.cppnative/bridge/include/jpdfium.hnative/bridge/src/pdf/api_text.cppnative/bridge/src/images/pixels.hnative/ocr/tests/ocr_engine.cppnative/bridge/src/runtime/api_status.hnative/bridge/src/runtime/domain.hnative/bridge/src/jpdfium_document.cppnative/bridge/src/runtime/domain.cppnative/bridge/tests/api_object_table.cppnative/bridge/tests/api_safety.cppnative/bridge/tests/api_image.cppnative/ocr/src/ort_session.hnative/bridge/src/output/output_transaction.cppnative/bridge/src/runtime/api_status.cppnative/ocr/src/profile.cppnative/bridge/src/runtime/api_module.cppnative/bridge/src/images/pixels.cppnative/bridge/src/pdf/api_raster.cppnative/ocr/src/paddle.hnative/bridge/src/pdf/api_render.cppnative/bridge/src/textlayer/text_layer.hnative/bridge/src/pdf/api_document.cppnative/bridge/tests/api_guards.cppnative/ocr/src/api_ocr.cppnative/bridge/src/runtime/api_runtime.cppnative/ocr/src/ort_session.cppnative/bridge/src/objects/objects.hnative/ocr/src/cv_compat.hnative/ocr/src/engine.hnative/bridge/src/output/image_writer.cppnative/bridge/tests/api_text_layer.cppnative/ocr/include/jpdfium_ocr.hnative/ocr/src/paddle.cppnative/bridge/src/output/image_writer.hnative/ocr/src/cv_compat.cppnative/bridge/src/images/api_bitmap.cppnative/bridge/src/objects/object_table.hnative/bridge/include/jpdfium_api.hnative/bridge/src/textlayer/text_layer.cppnative/bridge/src/legacy/guards_bridge.cpp
Check target-scoped flags, exported ABI, reproducibility, sanitizer instrumentation, dependency compatibility, and portable CPU targets.
⚙️ CodeRabbit configuration file
Files:
native/CMakeLists.txt
Enforce meaningful assertions, deterministic concurrency, failure-path cleanup, and explicit native/stub requirements.
⚙️ CodeRabbit configuration file
Files:
jpdfium/src/test/java/stirling/software/jpdfium/panama/RuntimeShutdownTest.javajpdfium/src/test/java/stirling/software/jpdfium/LifecycleTest.javajpdfium/src/test/java/stirling/software/jpdfium/panama/FastLinkFallbackTest.javajpdfium/src/test/java/stirling/software/jpdfium/panama/AbiHandshakeTest.javajpdfium/src/test/java/stirling/software/jpdfium/panama/DomainConsistencyTest.javajpdfium/src/test/java/stirling/software/jpdfium/panama/PdfiumRuntimeTest.java
Apply the Java 25 and FFM rules from .github/CODERABBIT_REVIEW.md.
⚙️ CodeRabbit configuration file
Files:
jpdfium/src/main/java/stirling/software/jpdfium/panama/FontLib.javajpdfium/src/test/java/stirling/software/jpdfium/panama/RuntimeShutdownTest.javajpdfium/src/test/java/stirling/software/jpdfium/LifecycleTest.javajpdfium/src/jmh/java/stirling/software/jpdfium/bench/PdfiumDomainBenchmark.javajpdfium/src/test/java/stirling/software/jpdfium/panama/FastLinkFallbackTest.javajpdfium/src/main/java/stirling/software/jpdfium/panama/FastLinks.javajpdfium/src/test/java/stirling/software/jpdfium/panama/AbiHandshakeTest.javajpdfium/src/main/java/stirling/software/jpdfium/panama/Symbols.javajpdfium/src/test/java/stirling/software/jpdfium/panama/DomainConsistencyTest.javajpdfium/src/main/java/stirling/software/jpdfium/panama/NativeDomain.javajpdfium/src/main/java/stirling/software/jpdfium/panama/JpdfiumH.javajpdfium/src/main/java/stirling/software/jpdfium/panama/PdfiumRuntime.javajpdfium/src/test/java/stirling/software/jpdfium/panama/PdfiumRuntimeTest.javajpdfium/src/main/java/stirling/software/jpdfium/panama/JpdfiumLib.java
Source excerpt: Use imports rather than package-qualified type names in method bodies and signatures.
📄 CodeRabbit inference engine (.github/CODERABBIT_REVIEW.md)
Files:
native/ocr/tests/tsan.suppjpdfium/src/main/java/stirling/software/jpdfium/panama/FontLib.javadocs/configuration.mddocs/design/JAVA_MIGRATION_INVENTORY.mdnative/bridge/include/jpdfium_internal.hnative/bridge/src/jpdfium_render.cppnative/rust/jpdfium-impl/Cargo.tomldocs/concurrency.mdnative/licenses/CLIPPER-BSL-1.0.txtnative/ocr/onnxruntime.versiondocs/design/DESIGN.mdjpdfium/src/test/java/stirling/software/jpdfium/panama/RuntimeShutdownTest.javajpdfium/src/test/java/stirling/software/jpdfium/LifecycleTest.javanative/bridge/src/objects/objects.cppNOTICEnative/ocr/tests/ocr_golden.incnative/build-real.shnative/ocr/profiles/pp-ocrv6-small.profilejpdfium/src/jmh/java/stirling/software/jpdfium/bench/PdfiumDomainBenchmark.javajpdfium/build.gradle.ktsnative/bridge/src/textlayer/api_text_layer.cppnative/bridge/src/objects/module_objects.hnative/bridge/src/runtime/guard.hnative/ocr/src/sha256.cppnative/ocr/profiles/pp-ocrv6-small-balanced.profilenative/ocr/fetch-onnxruntime.shnative/bridge/src/runtime/pdfium_core_stub.cppjpdfium/src/test/java/stirling/software/jpdfium/panama/FastLinkFallbackTest.javanative/ocr/tests/ocr_geometry.cppnative/bridge/include/jpdfium_core.hjpdfium/src/main/resources/META-INF/native-image/com.stirling/jpdfium/reachability-metadata.jsonjpdfium/src/main/java/stirling/software/jpdfium/panama/FastLinks.javanative/ocr/tests/lsan.suppdocs/design/JAVA_MIGRATION.mdnative/bridge/src/output/output_transaction.hnative/bridge/src/runtime/guard.cppnative/ocr/src/engine.cppnative/bridge/tests/api_raster.cppnative/bridge/include/jpdfium.hnative/bridge/src/pdf/api_text.cppnative/bridge/src/images/pixels.hnative/ocr/tests/ocr_engine.cppnative/bridge/src/runtime/api_status.hnative/bridge/src/runtime/domain.hnative/tools/downcall_inventory.pynative/bridge/src/jpdfium_document.cppjpdfium/src/test/java/stirling/software/jpdfium/panama/AbiHandshakeTest.javanative/bridge/src/runtime/domain.cppnative/bridge/tests/api_object_table.cppnative/bridge/tests/api_safety.cppjpdfium/src/main/java/stirling/software/jpdfium/panama/Symbols.javanative/bridge/tests/api_image.cppnative/ocr/src/ort_session.hnative/bridge/src/output/output_transaction.cppnative/bridge/src/runtime/api_status.cppnative/ocr/src/profile.cppnative/bridge/src/runtime/api_module.cppnative/bridge/src/images/pixels.cppnative/bridge/src/pdf/api_raster.cppnative/ocr/src/paddle.hnative/bridge/src/pdf/api_render.cppnative/bridge/src/textlayer/text_layer.hjpdfium/src/test/java/stirling/software/jpdfium/panama/DomainConsistencyTest.javanative/bridge/src/pdf/api_document.cppnative/bridge/tests/api_guards.cppjpdfium/src/main/java/stirling/software/jpdfium/panama/NativeDomain.javanative/ocr/src/api_ocr.cppnative/bridge/src/runtime/api_runtime.cppnative/CMakeLists.txtnative/ocr/tools/fetch_profile.pynative/ocr/src/ort_session.cppnative/bridge/src/objects/objects.hjpdfium/src/main/java/stirling/software/jpdfium/panama/JpdfiumH.javanative/ocr/src/cv_compat.hnative/ocr/src/engine.hjpdfium/src/main/java/stirling/software/jpdfium/panama/PdfiumRuntime.javanative/bridge/src/output/image_writer.cppnative/bridge/tests/api_text_layer.cppnative/ocr/tests/make_golden.pynative/ocr/include/jpdfium_ocr.hnative/ocr/src/paddle.cppnative/bridge/src/output/image_writer.hnative/tools/gen_guards.pynative/ocr/src/cv_compat.cppnative/rust/jpdfium-impl/src/lib.rsnative/bridge/src/images/api_bitmap.cppnative/bridge/src/objects/object_table.hnative/bridge/include/jpdfium_api.hjpdfium/src/test/java/stirling/software/jpdfium/panama/PdfiumRuntimeTest.javanative/bridge/src/textlayer/text_layer.cppnative/bridge/src/legacy/guards_bridge.cppjpdfium/src/main/java/stirling/software/jpdfium/panama/JpdfiumLib.java
🪛 ast-grep (0.45.3)
native/tools/downcall_inventory.py
[warning] 79-79: XPath query is request-/variable-derived; use parameterized XPath to prevent injection.
Context: DOWNCALL.findall(text)
Note: [CWE-643] Improper Neutralization of Data within XPath Expressions ('XPath Injection').
(xpath-injection-python)
[warning] 81-81: XPath query is request-/variable-derived; use parameterized XPath to prevent injection.
Context: JEXTRACT.findall(text)
Note: [CWE-643] Improper Neutralization of Data within XPath Expressions ('XPath Injection').
(xpath-injection-python)
native/ocr/tools/fetch_profile.py
[warning] 69-69: Request-controlled URL passed to urlopen; validate against an allowlist to prevent SSRF.
Context: urllib.request.urlopen(url, timeout=120)
Note: [CWE-918] Server-Side Request Forgery (SSRF).
(urlopen-unsanitized-data)
native/tools/gen_guards.py
[warning] 148-148: Regex pattern passed to re is built from a non-literal (variable, call, concatenation, or f-string) value. If that value is attacker-controlled it can introduce a malicious pattern with catastrophic backtracking (ReDoS). Use a hardcoded literal pattern, or validate/escape untrusted input with re.escape() and bound the regex complexity before compiling.
Context: re.search(r"\b%s\s*([^;{])\s(noexcept|JPDFIUM_NOEXCEPT)?\s*{" % name, stub)
Note: [CWE-1333] Inefficient Regular Expression Complexity.
(redos-non-literal-regex-python)
[error] 180-180: Command coming from incoming request
Context: subprocess.run(["clang-format", "-i", str(OUT_BRIDGE), str(OUT_PDFIUM)], check=True)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
(subprocess-from-request)
🪛 Clippy (1.98.1)
native/rust/jpdfium-impl/src/lib.rs
[warning] 735-735: this function has too many arguments (8/7)
(warning)
🪛 LanguageTool
docs/design/JAVA_MIGRATION.md
[grammar] ~57-~57: Use a hyphen to join words.
Context: ...diting, save, redaction) each get coarse safe operations, one family per chang...
(QB_NEW_EN_HYPHEN)
🪛 Ruff (0.16.8)
native/tools/downcall_inventory.py
[warning] 94-96: Unparenthesized implicit string concatenation in collection
Did you forget a comma?
(ISC004)
[warning] 98-101: Unparenthesized implicit string concatenation in collection
Did you forget a comma?
(ISC004)
native/ocr/tools/fetch_profile.py
[warning] 44-44: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 47-47: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 50-50: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 69-70: Use a single with statement with multiple contexts instead of nested with statements
(SIM117)
[warning] 75-75: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 85-85: Avoid specifying long messages outside the exception class
(TRY003)
native/tools/gen_guards.py
[warning] 68-68: for loop variable param overwritten by assignment target
(PLW2901)
[warning] 148-148: Use format specifiers instead of percent format
Replace with format specifiers
(UP031)
[error] 180-180: subprocess call: check for execution of untrusted input
(S603)
[error] 180-180: Starting a process with a partial executable path
(S607)
🔇 Additional comments (81)
native/bridge/src/pdf/api_document.cpp (1)
25-156: LGTM!native/bridge/src/pdf/api_render.cpp (1)
1-189: LGTM!native/bridge/src/pdf/api_raster.cpp (1)
1-311: LGTM!native/bridge/src/pdf/api_text.cpp (1)
1-105: LGTM!native/bridge/src/images/pixels.h (1)
1-41: LGTM!native/bridge/src/images/pixels.cpp (1)
14-74: LGTM!native/bridge/src/output/image_writer.cpp (1)
16-115: LGTM!native/bridge/src/output/image_writer.h (1)
1-74: LGTM!native/bridge/tests/api_safety.cpp (1)
1-487: LGTM!native/bridge/tests/api_text_layer.cpp (1)
1-592: LGTM!native/bridge/tests/api_image.cpp (1)
1-203: LGTM!native/bridge/tests/api_raster.cpp (1)
1-348: LGTM!native/bridge/src/textlayer/api_text_layer.cpp (1)
12-32: LGTM!native/bridge/src/textlayer/text_layer.cpp (1)
1-1216: LGTM!native/bridge/src/textlayer/text_layer.h (1)
1-73: LGTM!native/rust/jpdfium-impl/Cargo.toml (1)
16-17: LGTM!native/bridge/src/output/output_transaction.h (1)
1-57: LGTM!native/build-real.sh (1)
37-41: LGTM!.gitignore (1)
80-80: LGTM!NOTICE (1)
46-56: LGTM!native/licenses/CLIPPER-BSL-1.0.txt (1)
1-26: LGTM!native/ocr/fetch-onnxruntime.sh (1)
1-46: LGTM!native/ocr/include/jpdfium_ocr.h (1)
1-103: LGTM!native/ocr/onnxruntime.version (1)
1-8: LGTM!native/ocr/profiles/pp-ocrv6-small-balanced.profile (1)
1-20: LGTM!native/ocr/profiles/pp-ocrv6-small.profile (1)
1-20: LGTM!native/ocr/src/api_ocr.cpp (2)
134-318: LGTM!
102-110: 🎯 Functional CorrectnessNo unsupported pixel format reaches
read_bitmap.The API defines only
JPDF_PIXEL_RGBA8,JPDF_PIXEL_RGB8, andJPDF_PIXEL_GRAY8.read_bitmapconverts each format correctly to BGR. Rendered and decoded bitmaps validate or assign one of these formats, and rectification preserves the source format. The proposed BGR and larger-pixel cases do not exist in this API.native/ocr/src/cv_compat.cpp (1)
106-417: LGTM!Also applies to: 419-713, 719-925
native/ocr/src/engine.cpp (1)
16-127: LGTM!native/ocr/src/engine.h (1)
1-79: LGTM!native/ocr/src/ort_session.cpp (1)
1-161: LGTM!native/ocr/src/ort_session.h (1)
1-44: LGTM!native/ocr/src/paddle.cpp (1)
1-467: LGTM!native/ocr/src/paddle.h (1)
1-96: LGTM!native/ocr/src/profile.cpp (1)
1-183: LGTM!native/ocr/src/sha256.cpp (1)
1-106: LGTM!native/ocr/tests/lsan.supp (1)
1-2: LGTM!native/ocr/tests/make_golden.py (1)
1-120: LGTM!native/ocr/tests/ocr_engine.cpp (1)
1-220: LGTM!native/ocr/tests/ocr_geometry.cpp (1)
1-243: LGTM!native/ocr/tests/ocr_golden.inc (1)
1-36: LGTM!native/ocr/tests/tsan.supp (1)
1-2: LGTM!native/ocr/tools/fetch_profile.py (1)
1-93: LGTM!jpdfium/build.gradle.kts (1)
370-375: LGTM!Also applies to: 390-392, 409-414
jpdfium/src/main/java/stirling/software/jpdfium/panama/FastLinks.java (1)
27-29: LGTM!Also applies to: 50-51, 67-70
jpdfium/src/main/java/stirling/software/jpdfium/panama/FontLib.java (1)
5-5: LGTM!Also applies to: 27-28
jpdfium/src/main/java/stirling/software/jpdfium/panama/JpdfiumH.java (1)
16-18: LGTM!Also applies to: 44-46
jpdfium/src/main/java/stirling/software/jpdfium/panama/JpdfiumLib.java (1)
76-88: LGTM!Also applies to: 97-98, 130-130
jpdfium/src/main/java/stirling/software/jpdfium/panama/NativeDomain.java (1)
1-322: LGTM!jpdfium/src/main/java/stirling/software/jpdfium/panama/PdfiumRuntime.java (2)
108-142: LGTM!Also applies to: 206-212
69-106: 🩺 Stability & AvailabilityDo not require a single-entry render wrapper for this path.
PdfiumRuntimerequires documents to be used by one thread at a time. No JavaCleaneror finalizer path closes these resources. A concurrent close or structural mutation therefore violates the documented threading contract. The stale-pointer behavior may occur under unsupported concurrent use, but it is not an actionable defect in the supported API.jpdfium/src/main/java/stirling/software/jpdfium/panama/Symbols.java (1)
18-20: LGTM!Also applies to: 51-89, 101-101, 111-111
jpdfium/src/main/resources/META-INF/native-image/com.stirling/jpdfium/reachability-metadata.json (1)
156-166: LGTM!Also applies to: 232-246
jpdfium/src/test/java/stirling/software/jpdfium/LifecycleTest.java (1)
320-328: LGTM!jpdfium/src/test/java/stirling/software/jpdfium/panama/AbiHandshakeTest.java (1)
14-71: LGTM!jpdfium/src/test/java/stirling/software/jpdfium/panama/DomainConsistencyTest.java (1)
77-114: LGTM!jpdfium/src/test/java/stirling/software/jpdfium/panama/FastLinkFallbackTest.java (1)
10-11: LGTM!Also applies to: 33-44
jpdfium/src/test/java/stirling/software/jpdfium/panama/PdfiumRuntimeTest.java (1)
8-149: LGTM!jpdfium/src/test/java/stirling/software/jpdfium/panama/RuntimeShutdownTest.java (1)
16-16: LGTM!Also applies to: 27-27
native/CMakeLists.txt (1)
120-153: LGTM!Also applies to: 234-253, 690-749, 782-785, 833-895
native/bridge/src/runtime/pdfium_core_stub.cpp (1)
1-26: LGTM!native/bridge/src/objects/objects.cpp (1)
1-16: LGTM!native/bridge/src/objects/objects.h (1)
1-75: LGTM!native/bridge/src/objects/module_objects.h (1)
1-32: LGTM!native/bridge/src/runtime/domain.h (1)
1-97: LGTM!native/bridge/src/runtime/guard.h (1)
1-28: LGTM!native/tools/gen_guards.py (1)
1-188: LGTM!native/bridge/src/legacy/guards_bridge.cpp (1)
1-693: LGTM!native/bridge/src/jpdfium_document.cpp (1)
223-238: LGTM!Also applies to: 331-335
native/bridge/src/jpdfium_render.cpp (1)
284-288: LGTM!native/bridge/tests/api_guards.cpp (1)
1-290: LGTM!native/bridge/include/jpdfium.h (1)
53-54: LGTM!Also applies to: 101-104
native/bridge/include/jpdfium_api.h (1)
1-433: LGTM!native/bridge/include/jpdfium_core.h (1)
1-13: LGTM!native/bridge/include/jpdfium_internal.h (1)
22-22: LGTM!Also applies to: 378-381
native/bridge/src/runtime/api_status.cpp (1)
1-66: LGTM!native/bridge/src/runtime/api_status.h (1)
1-41: LGTM!native/bridge/src/objects/object_table.h (1)
1-170: LGTM!native/bridge/src/runtime/api_runtime.cpp (1)
1-207: LGTM!native/bridge/tests/api_object_table.cpp (1)
1-143: LGTM!
ba5903b to
5258f03
Compare
There was a problem hiding this comment.
Actionable comments posted: 5
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository: Stirling-Tools/JPDFium/.coderabbit.yaml
- Review profile: ASSERTIVE
- Plan: Advanced
- Run ID:
34f2e118-3eab-4c6c-9e2c-d07fdb63a46b
📒 Files selected for processing (18)
.github/scripts/check-native-symbols.sh.github/workflows/ci.ymldocs/concurrency.mddocs/design/DESIGN.mddocs/design/JAVA_MIGRATION_INVENTORY.mdjpdfium/src/jmh/java/stirling/software/jpdfium/bench/PdfiumDomainBenchmark.javanative/bridge/src/images/api_bitmap.cppnative/bridge/src/jpdfium_document.cppnative/bridge/src/jpdfium_image.cppnative/bridge/src/output/output_transaction.cppnative/bridge/src/runtime/api_module.cppnative/bridge/src/runtime/guard.cppnative/build-real.shnative/ocr/src/cv_compat.cppnative/ocr/src/engine.hnative/ocr/src/ort_session.cppnative/rust/jpdfium-impl/src/lib.rsnative/tools/downcall_inventory.py
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
📜 Review details
⏰ Context from checks skipped due to timeout. (15)
- GitHub Check: Native bridge libFuzzer (ASan/UBSan, real PDFium)
- GitHub Check: CLI correctness & no-corruption tests
- GitHub Check: Flaky-test guard (3× rerun)
- GitHub Check: Build & Verify (Compilation) (windows-latest)
- GitHub Check: GraalVM Native Image Smoke & E2E Test (Linux x64)
- GitHub Check: CodeQL Analysis (java-kotlin)
- GitHub Check: Java - SpotBugs + Checkstyle + PMD + Spotless
- GitHub Check: JMH Benchmarks (FFM Downcall Overhead Gate)
- GitHub Check: Samples E2E Suite (All 88 Feature Samples)
- GitHub Check: Samples E2E (88 features via RunAllSamples)
- GitHub Check: Corpus (generate + native)
- GitHub Check: build-natives (windows-arm64, windows-11-arm)
- GitHub Check: build-natives (windows-x64, windows-latest)
- GitHub Check: Restricted-env compat (no execstack + hermetic bundle)
- GitHub Check: CodeQL Analysis (c-cpp)
🧰 Additional context used
📚 Code guidelines (1)
.github/CODERABBIT_REVIEW.md — configured
📓 Path-based instructions (3)
Apply the native ownership, C ABI, C++23, engine integration, memory, and SIMD rules from .github/CODERABBIT_REVIEW.md.
⚙️ CodeRabbit configuration file
Files:
native/ocr/src/ort_session.cppnative/bridge/src/runtime/guard.cppnative/bridge/src/jpdfium_image.cppnative/bridge/src/output/output_transaction.cppnative/ocr/src/cv_compat.cppnative/bridge/src/runtime/api_module.cppnative/bridge/src/images/api_bitmap.cppnative/bridge/src/jpdfium_document.cppnative/ocr/src/engine.h
Apply the Java 25 and FFM rules from .github/CODERABBIT_REVIEW.md.
⚙️ CodeRabbit configuration file
Files:
jpdfium/src/jmh/java/stirling/software/jpdfium/bench/PdfiumDomainBenchmark.java
Source excerpt: Use imports rather than package-qualified type names in method bodies and signatures.
📄 CodeRabbit inference engine (.github/CODERABBIT_REVIEW.md)
Files:
docs/design/DESIGN.mddocs/design/JAVA_MIGRATION_INVENTORY.mdnative/ocr/src/ort_session.cppnative/bridge/src/runtime/guard.cppnative/bridge/src/jpdfium_image.cppnative/bridge/src/output/output_transaction.cppdocs/concurrency.mdnative/build-real.shjpdfium/src/jmh/java/stirling/software/jpdfium/bench/PdfiumDomainBenchmark.javanative/ocr/src/cv_compat.cppnative/tools/downcall_inventory.pynative/bridge/src/runtime/api_module.cppnative/bridge/src/images/api_bitmap.cppnative/bridge/src/jpdfium_document.cppnative/ocr/src/engine.hnative/rust/jpdfium-impl/src/lib.rs
🪛 ast-grep (0.45.3)
native/tools/downcall_inventory.py
[warning] 79-79: XPath query is request-/variable-derived; use parameterized XPath to prevent injection.
Context: DOWNCALL.findall(text)
Note: [CWE-643] Improper Neutralization of Data within XPath Expressions ('XPath Injection').
(xpath-injection-python)
[warning] 81-81: XPath query is request-/variable-derived; use parameterized XPath to prevent injection.
Context: JEXTRACT.findall(text)
Note: [CWE-643] Improper Neutralization of Data within XPath Expressions ('XPath Injection').
(xpath-injection-python)
🪛 Clippy (1.98.1)
native/rust/jpdfium-impl/src/lib.rs
[warning] 735-735: this function has too many arguments (8/7)
(warning)
🪛 Ruff (0.16.8)
native/tools/downcall_inventory.py
[warning] 94-96: Unparenthesized implicit string concatenation in collection
Did you forget a comma?
(ISC004)
[warning] 98-101: Unparenthesized implicit string concatenation in collection
Did you forget a comma?
(ISC004)
🔇 Additional comments (11)
native/build-real.sh (1)
61-85: LGTM!native/ocr/src/cv_compat.cpp (1)
1-927: LGTM!native/tools/downcall_inventory.py (1)
1-120: LGTM!native/ocr/src/ort_session.cpp (1)
1-161: LGTM!native/ocr/src/engine.h (1)
1-113: LGTM!native/bridge/src/runtime/guard.cpp (1)
14-15: LGTM!Also applies to: 18-21, 28-31
native/bridge/src/jpdfium_document.cpp (1)
332-333: 🎯 Functional CorrectnessThe authority is intentionally process-scoped.
jpdfium_core.hstates that the first authority claim wins for the process lifetime. The safe runtime is also documented as final after shutdown, andjpdf_runtime_init()rejects an existing legacy owner. Therefore, switching from the legacy bridge to the safe runtime afterjpdfium_destroy()is not a supported transition, so clearingg_pdfiumAuthoritywould violate the ownership contract.native/bridge/src/images/api_bitmap.cpp (1)
1-257: LGTM!Also applies to: 285-512
native/bridge/src/output/output_transaction.cpp (2)
1-101: LGTM!Also applies to: 108-218, 248-265
219-246: 🗄️ Data Integrity & IntegrationDo not treat the Windows durable path as equivalent to POSIX file-and-directory sync.
finalize()flushes the staging-file contents on Windows with_commitwhendurable_is enabled. However,publish()relies onMoveFileExW(..., MOVEFILE_WRITE_THROUGH), whose documented durability guarantee does not clearly cover same-volume rename metadata.JPDF_WRITE_DURABLEmay therefore returnJPDF_OKwithout establishing that the replacement survives power loss. Use a documented Windows mechanism for durable publication, or narrow the durability guarantee.native/rust/jpdfium-impl/src/lib.rs (1)
635-678: LGTM!Also applies to: 698-909, 911-1063
2d066ce to
c0d09c9
Compare
…main # Conflicts: # settings.gradle.kts
…main Resolve the 20261019 PDFium pin bump against the native safe-domain work: adopt EPDFPage_ApplyRedactions while keeping the RAII text/annotation handles, retain both exact-export checking and nm retries, keep both member-level API exclusions and both new downcall metadata entries, restore the Arena import used by the rotation lookup, and regenerate the legacy PDFium guards against the new headers.
Track every long-lived PDFium handle type in shutdown accounting and fail guard generation when an open/close pair is missing or unbalanced. Register document and page identity so a raw close and a bridge close cannot decrement twice. Only consult the guard refusal after a zero result (always for void), and remove the misleading downcallCritical alias. Replace std::timed_mutex with a plain mutex and a try_lock backoff, with shutdown taking the same bounded wait. Use ONNX Runtime global thread pools with per-session threads disabled, disable spinning, memory patterns and the session arena. Pin shipped OCR profiles to compiled-in SHA-256 digests, accept a caller-supplied digest for custom profiles, and refuse duplicate profile roles. Specialize the OCR bitmap conversion per pixel format. Make durable output use F_FULLFSYNC on macOS, report the Windows MoveFileExW error, remove stale staging files from dead processes, and document that publication does not preserve hard links, ACLs, xattrs or ownership. Update the design notes and Java downcall inventory.
Symbols.downcallCritical is part of the released Java surface; japicmp refuses its removal. Keep it as a deprecated alias of downcall for binary compatibility while every binding uses the clearer name.
Summary
A native-first core that the Java binding and the new Python binding (PyJPDFium) share. One stage per commit:
jpdf_*C API (jpdfium_api.h), now at 1.5.jpdf_guard_*shims admitted by the same domain, with no Java-side lock.generate_pdfcontract) and page text extraction.libjpdfium_ocr.native/dist/ocr-<platform>, outside the core bundle, so the core's size budget holds.check-native-symbols.shno longer fails spuriously underpipefail.Design notes are in
docs/design/:ARCHITECTURE.md,NATIVE_ABI.md,TEXT_LAYER.md,OCR.md,RASTER.md,TESTING.md.Testing
ctestagainst real PDFium, 11 of 11, including OCR with both profiles.Notes
build-qpdf-native-crypto.shandbuild-harfbuzz-no-glib.shfetch upstream's latest release without a pinned version or digest. They were not run here and should be pinned separately.