Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Recv receives CANFD and triggers panic #78

Closed
@0xsmirk

Description

@0xsmirk

This is code:

use socketcan::{CanFdSocket,Socket};use std::error::Error;fnmain() ->Result<(),Box<dynError>>{// Open the CAN devicelet socket =CanFdSocket::open("can0")?;// Set non-blocking mode    socket.set_nonblocking(true).map_err(|e|{eprintln!("Failed to set non-blocking mode: {}", e);        e})?;loop{// Read CAN framematch socket.read_frame(){Ok(frame) =>{// Print the received CAN frameprintln!("Received frame: {:?}", frame);}Err(e)if e.kind() == std::io::ErrorKind::WouldBlock =>{// If there are no readable frames, continue the loopcontinue;}Err(e) =>{// Handle other errorsdbg!("Error reading frame: {}", e);}}}}

When running, the following is the situation

smirk@veh:~/project/canfuzz$ cargo run     Finished`dev` profile [unoptimized + debuginfo] target(s)in 0.10swarning: the following packages contain code that will be rejected by a future version of Rust: bitfwarning: the following packages contain code that will be rejected by a future version of Rust: bitflags v0.4.0note: to see what the problems were, use the option`--future-incompat-report`, or run`cargo reportnote: to see what the problems were, use the option`--future-incompat-report`, or run`cargo report future-incompatibilities --id 1`     Running`target/debug/canfuzz`Received frame: Fd(CanFdFrame { 45##5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00Received frame: Fd(CanFdFrame { 45##5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00thread'main' panicked at core/src/panicking.rs:221:5:unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aunsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory rangesdo not overlapnote: run with`RUST_BACKTRACE=1` environment variable to display a backtracethread caused non-unwinding panic. aborting.Aborted (core dumped)

The panic triggering time is not fixed.
I want to achieve the same functionality as candump, but use candump without interruption, and write my own code to trigger panic

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp