Repairing Leaks in Resource Wrappers

📅 2025-10-03
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Resource leaks caused by resource wrappers remain inadequately addressed, as existing approaches only support hardcoded library types and fail to handle the prevalent wrapper patterns in real-world code. Method: This paper proposes a novel repair technique integrating resource management policy inference with program transformation. It introduces a field-containment analysis to precisely identify encapsulated resources within non-final fields and shifts vulnerability localization to client-side code, significantly broadening the scope of repairable cases. By combining static analysis, field-level resource lifecycle modeling, and a new repair pattern, the approach enhances modeling fidelity for complex, multi-stage resource lifetimes. Results: Evaluated on the NJR benchmark, the method achieves a 68% repair rate—substantially outperforming prior work (41%) and demonstrating state-of-the-art effectiveness in automated resource leak repair.

Technology Category

Application Category

📝 Abstract
A resource leak occurs when a program fails to release a finite resource like a socket, file descriptor or database connection. While sound static analysis tools can detect all leaks, automatically repairing them remains challenging. Prior work took the output of a detection tool and attempted to repair only leaks from a hard-coded list of library resource types. That approach limits the scope of repairable leaks: real-world code uses resource wrappers that store a resource in a field and must themselves be closed. This paper makes four key contributions to improve resource leak repair in the presence of wrappers. (1) It integrates inference of resource management specifications into the repair pipeline, enabling extant fixing approaches to reason about wrappers. (2) It transforms programs into variants that are easier to analyze, making inference, detection, and fixing tools more effective; for instance, it makes detection tools report problems closer to the root cause, often in a client of a resource wrapper rather than within the wrapper class itself. (3) A novel field containment analysis reasons about resource lifetimes, enabling repair of more leaks involving resources stored in fields. (4) It introduces a new repair pattern and more precise reasoning to better handle resources stored in non-final fields. Prior work fixed 41% of resource leak warnings in the NJR benchmark suite; our implementation Arodnap fixes 68%.
Problem

Research questions and friction points this paper is trying to address.

Automatically repairing resource leaks in wrapper-based code structures
Enhancing static analysis to handle resources stored in object fields
Improving repair precision for non-final field resource management
Innovation

Methods, ideas, or system contributions that make the work stand out.

Integrates resource management specification inference into repair
Transforms programs for easier analysis and root cause detection
Uses field containment analysis for lifetime reasoning of resources
🔎 Similar Papers
No similar papers found.