Skip to content

Miri is confused by a variadic call in px4 #2191

Closed as not planned
Closed as not planned
@saethlin

Description

@saethlin

Yay more confusion with variadics

https://miri.saethlin.dev/ub?crate=px4&version=0.2.4

error: Undefined Behavior: calling a c-variadic function via a non-variadic call site, or vice versa
  --> /root/build/src/logging.rs:21:3
   |
21 | /         px4_log_raw(
22 | |             level as i32,
23 | |             "%.*s\0".as_ptr(),
24 | |             message.len() as i32,
25 | |             message.as_ptr(),
26 | |         );
   | |_________^ calling a c-variadic function via a non-variadic call site, or vice versa
   |

I don't know what a variadic call site means. But this looks like a perfectly valid call to me, all the variadic arguments fit in a usize. It's not possible to type check a variadic call without knowing how the callee is going to interpret things, so I feel like we should either be quiet on the issue or reject them altogether?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions