C vs Rust: Manual vs Automatic Spatial and Temporal Memory Safety

The C programming language is commonly used for creating high-performance and low-level applications such as device drivers and operating systems due to its efficiency. However, despite its performance capabilities, C is known for its vulnerabilities and unsafe coding practices. Rust is presented as an alternative to C, with a focus on improved safety without compromising performance. Rust employs ownership and borrowing concepts to manage memory usage, ensuring that the memory cannot be manipulated freely without adhering to specific rules designed to prevent security attacks. The memory restrictions are implemented either at compile time or runtime without requiring the programmer's direct involvement; however, the programmer must adhere to a strict coding standard. In contrast, C programs can be secured by manually implementing similar restrictions on memory access and adding checks for unpredictable runtime behavior. While this approach offers some protection against attacks, it requires the developer to have detailed knowledge of memory management and programming best practices. This research focuses on evaluating memory safety issues in terms of spatial and temporal safety, comparing Rust's security mechanisms (or lack thereof) to C. Spatial safety involves securing vulnerable memory locations, while temporal safety ensures safe access to memory at different times. These concepts are frequently exploited by attackers to access data or inject attack payload. Our analysis demonstrates that Rust offers stronger guarantees for memory safety compared to manual security implementations in C. However, C remains a viable option for performance-critical applications, as it can still be secured through careful coding practices.

Authors

Institutions

Publication Details

Journal
Indonesian Journal of Computer Science
Published
2025-04-15
DOI
https://doi.org/10.33022/ijcs.v14i2.4640
Primary Topic
Human-Automation Interaction and Safety
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

C vs Rust: Manual vs Automatic Spatial and Temporal Memory Safety

Amril Syalim, Dewangga Putra Sheradhien
Indonesian Journal of Computer Science
Human-Automation Interaction and Safety
article

C vs Rust: Manual vs Automatic Spatial and Temporal Memory Safety

Amril Syalim, Dewangga Putra Sheradhien
article en

Abstract

The C programming language is commonly used for creating high-performance and low-level applications such as device drivers and operating systems due to its efficiency. However, despite its performance capabilities, C is known for its vulnerabilities and unsafe coding practices. Rust is presented as an alternative to C, with a focus on improved safety without compromising performance. Rust employs ownership and borrowing concepts to manage memory usage, ensuring that the memory cannot be manipulated freely without adhering to specific rules designed to prevent security attacks. The memory restrictions are implemented either at compile time or runtime without requiring the programmer's direct involvement; however, the programmer must adhere to a strict coding standard. In contrast, C programs can be secured by manually implementing similar restrictions on memory access and adding checks for unpredictable runtime behavior. While this approach offers some protection against attacks, it requires the developer to have detailed knowledge of memory management and programming best practices. This research focuses on evaluating memory safety issues in terms of spatial and temporal safety, comparing Rust's security mechanisms (or lack thereof) to C. Spatial safety involves securing vulnerable memory locations, while temporal safety ensures safe access to memory at different times. These concepts are frequently exploited by attackers to access data or inject attack payload. Our analysis demonstrates that Rust offers stronger guarantees for memory safety compared to manual security implementations in C. However, C remains a viable option for performance-critical applications, as it can still be secured through careful coding practices.

Indonesian Journal of Computer ScienceVol. 14(2)
University of Indonesia (ID)
Openalex Percentile: Top 91%
Human-Automation Interaction and Safety
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.