Unions, which allow multiple data types to share a single memory space, have been consistently used from the early development of the C language to modern programming languages. Initially designed to overcome the limitations of insufficient hardware c...
Unions, which allow multiple data types to share a single memory space, have been consistently used from the early development of the C language to modern programming languages. Initially designed to overcome the limitations of insufficient hardware capacity, unions remain commonly used today for system optimization and efficiency, even in an era of ample hardware resources. However, due to the nature of union data handling, incorrect type interpretation or improper access by programmers can lead to memory corruption or unexpected behavior, resulting in union type safety violation vulnerabilities. Previously proposed detection tools for type safety violations have either focused solely on class casting or targeted union type safety violations in the context of COM (Component Object Model). As such, research focusing on detecting union type safety violations in C/C++ applications is still insufficient. Therefore, this paper proposes UnionTypeSan, a dynamic runtime detection tool for union type safety violations.