spernsteiner
spernsteiner
This branch adds basic interprocedural analysis for pointer permissions. It propagates the "easy"/dataflow permissions, such as `WRITE` and `OFFSET_ADD`, across function calls and returns. For example, given `fn f(x: *mut...
This exposes some configuration options that were previously controlled by environment variables as command-line options for the cargo wrapper, and also adds a few new options: * `--rewrite-in-place`: Overwrite source...
We'd like to be able to fully refactor lighttpd's `algo_md5` module into safe Rust. This tracking issue covers analysis features that will be required to support that: * [x] Casts...
`c2rust-transpile` uses `Option` to represent C function pointers, which can be null. This means it often emits code like `fp = Some(f)`. `dataflow::type_check` currently fails on this code, since the...
1. ``` known permissions changed for DefId(0:39 ~ lighttpd_rust_amalgamated[c1eb]::{extern#0}::getenv): LFnSig { inputs: [g1868#*const i8[NONE#i8[]]], output: g1869#*mut i8[NONE#i8[]] } known permissions changed for PointerId g1869: READ | OFFSET_ADD -> READ |...
```C int f() { unsigned x = { 1 }; return x; } int g() { int x = { 1 }; return x; } ``` Translation of `g` succeeds....
```Rust unsafe fn f(x: *const u8) -> *const i8 { std::mem::transmute(x) } ``` Triggers an internal compiler error: ``` visit_terminator(_0 = std::intrinsics::transmute::(move _2) -> [return: bb1, unwind: bb2]) unsafe extern...
```Rust struct NeedsLifetime { p: *mut u8, } type Alias = NeedsLifetime; ``` After rewriting: ```Rust struct NeedsLifetime
```Rust use c2rust_bitfields::BitfieldStruct; #[derive(BitfieldStruct)] pub struct Foo { pub x: &'static i32, #[bitfield(name = "flags", ty = "u32", bits = "0..=7")] pub flags: [u8; 1], } #[derive(BitfieldStruct)] pub struct Bar...
Realloc is supposed to get special handling to prevent the cast in `realloc(p as *mut c_void, n)` from causing an error. However, this doesn't seem to work reliably. Example code...