Exposing library API misuses via mutation analysis

M Wen, Y Liu, R Wu, X Xie… - 2019 IEEE/ACM 41st …, 2019 - ieeexplore.ieee.org
2019 IEEE/ACM 41st International Conference on Software …, 2019ieeexplore.ieee.org
Misuses of library APIs are pervasive and often lead to software crashes and vulnerability
issues. Various static analysis tools have been proposed to detect library API misuses. They
often involve mining frequent patterns from a large number of correct API usage examples,
which can be hard to obtain in practice. They also suffer from low precision due to an over-
simplified assumption that a deviation from frequent usage patterns indicates a misuse. We
make two observations on the discovery of API misuse patterns. First, API misuses can be …
Misuses of library APIs are pervasive and often lead to software crashes and vulnerability issues. Various static analysis tools have been proposed to detect library API misuses. They often involve mining frequent patterns from a large number of correct API usage examples, which can be hard to obtain in practice. They also suffer from low precision due to an over-simplified assumption that a deviation from frequent usage patterns indicates a misuse. We make two observations on the discovery of API misuse patterns. First, API misuses can be represented as mutants of the corresponding correct usages. Second, whether a mutant will introduce a misuse can be validated via executing it against a test suite and analyzing the execution information. Based on these observations, we propose MutApi, the first approach to discovering API misuse patterns via mutation analysis. To effectively mimic API misuses based on correct usages, we first design eight effective mutation operators inspired by the common characteristics of API misuses. MutApi generates mutants by applying these mutation operators on a set of client projects and collects mutant-killing tests as well as the associated stack traces. Misuse patterns are discovered from the killed mutants that are prioritized according to their likelihood of causing API misuses based on the collected information. We applied MutApi on 16 client projects with respect to 73 popular Java APIs. The results show that MutApi is able to discover substantial API misuse patterns with a high precision of 0.78. It also achieves a recall of on the MuBench benchmark, which outperforms the state-of-the-art techniques.
ieeexplore.ieee.org