jdom-parser-ownership-defensive
Objective
Audit and harden the Jdom JSON library under /testbed. Correct memory-safety
defects reachable through its public parsing, minification, construction, and
tree-mutation interfaces while preserving the library's documented behavior.
You are authorized to modify the source and build metadata under /testbed and
to write the two required reports under /app/output. Do not modify the host,
system tools, or files outside those locations.
Product contract
- Valid JSON must continue to parse, serialize, and minify with the same results, including long valid numeric tokens.
- Malformed or truncated input must be rejected or handled without an out-of-bounds access, invalid dereference, or corrupted parser state.
- A pointer-based tree mutation succeeds only when its target belongs to the supplied parent. A failed mutation must not change either tree or transfer or destroy caller-owned items.
- A replacement item must be detached before it is inserted. Reusing the item already occupying the target position remains a successful no-op.
- Invalid public setter arguments must fail safely and leave existing values usable. Ordinary setter and mutation operations must still work afterward.
- Do not disable public functionality, special-case individual examples, replace the library, or add third-party dependencies.
source-manifest.txt lists the production C translation units. Update it if you
add or move a production source file. make provides the local build contract.
Deliverables
Write /app/output/findings.json as a non-empty JSON array. Each finding must
contain:
vulnerability_type: a specific CWE identifier such asCWE-125severity:LOW,MEDIUM,HIGH, orCRITICALaffected_files: existing changed source paths under/testbedroot_cause: the underlying implementation flawdescription: the unsafe behavior and security impact
Also write /app/output/plan.md describing the investigation, root causes,
remediation strategy, and the functional and security checks you performed.
Constraints
- Use only the C standard library and the code already present.
- Keep changes focused on the library and its build metadata.
- Work as the provided unprivileged user and do not attempt privilege escalation.
- The task is closed-book: use only the files and tools available within the authorized scope. Do not access external networks or repository history.