khklau / mod_tile_rs

A prototype Rust implementation of the tile module for Apache 2 webserver
GNU Affero General Public License v3.0
0 stars 0 forks source link

bindgen generating Apache2 bindings with undefined behavior #23

Open khklau opened 2 years ago

khklau commented 2 years ago

Currently using bindgen 0.57.0 and it is generating bindings to the Apache2 framework that produces undefined behavior:

warning: dereferencing a null pointer
    --> /home/kean/workspace/mod_tile_rs/target/debug/build/mod_tile_rs-fc2bd6664472f2ae/out/bindings.rs:2063:19
     |
2063 |         unsafe { &(*(::std::ptr::null::<__fsid_t>())).__val as *const _ as usize },
     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
     |
     = note: `#[warn(deref_nullptr)]` on by default 

If this issue isn't resolved in the latest bindgen version, I have to raise a ticket with them.

khklau commented 2 years ago

Unfortunately updating to bindgen 0.59.2 has not solved the problem. For now I'm working around the null pointer deref warnings by disabling them.

khklau commented 2 years ago

It's a known issue by the bindgen maintainers and has already been raised as issue 2104.

Luckily it only seems to affect auto-generated tests and not the bindings themselves.