Skip to content

Commit

Permalink
Bump dependencies to latest versions (#246)
Browse files Browse the repository at this point in the history
* Bump dependencies to latest versions

* Do not print empty description

* Replace tabs in casr-java report
  • Loading branch information
SweetVishnya authored Feb 24, 2025
1 parent ff57afd commit 5c3d818
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 27 deletions.
10 changes: 5 additions & 5 deletions casr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ shell-words = "1.1"
anyhow = "1.0"
clap = { version = "4.5", features = ["wrap_help", "cargo", "env"] }
chrono = "0.4"
goblin = "0.8"
goblin = "0.9"
log = "0.4"
simplelog = "0.12"
cursive = { version = "0.21", default-features = false, features = ["termion-backend"] }
cursive_tree_view = "0.9"
gdb-command = "0.7"
nix = "0.26"
nix = { version = "0.29", features = ["fs"] }
rayon = "1.10"
num_cpus = "1.16"
is_executable = "1.0"
linux-personality = "2.0"
colored = "2.0"
colored = "3.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
regex = "1"
Expand All @@ -36,7 +36,7 @@ reqwest = { version = "0.12", features = ["json", "multipart", "rustls-tls"], de
tokio = { version = "1", features = ["rt", "macros"], optional = true }
toml = { version = "0.8", optional = true }
wait-timeout = "0.2"
which = "6.0"
which = "7.0"
copy_dir = "0.1"

libcasr = { path = "../libcasr", version = "2.12.1", features = ["serde", "exploitable"] }
Expand All @@ -52,5 +52,5 @@ name = "casr-dojo"
required-features = ["dojo"]

[dev-dependencies]
lazy_static = "1.4"
lazy_static = "1.5"
lsb_release = "0.1"
12 changes: 7 additions & 5 deletions casr/src/bin/casr-cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,13 @@ fn build_tree_report(
Placement::LastChild,
row,
);
tree.insert_item(
report.execution_class.description.to_string(),
Placement::LastChild,
row,
);
if !report.execution_class.description.is_empty() {
tree.insert_item(
report.execution_class.description.to_string(),
Placement::LastChild,
row,
);
}
if !report.execution_class.explanation.is_empty() {
tree.insert_item(
report.execution_class.explanation.to_string(),
Expand Down
18 changes: 9 additions & 9 deletions casr/src/bin/casr-core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ use gdb_command::{ExecType, GdbCommand};
use goblin::container::Endian;
use goblin::elf::{Elf, header, note};
use log::{error, warn};
use nix::fcntl::{FlockArg, flock};
use nix::fcntl::{Flock, FlockArg};
use simplelog::*;
use std::fs::{File, OpenOptions};
use std::io::prelude::*;
use std::io::{self, Read};
use std::os::unix::io::AsRawFd;
use std::path::{Path, PathBuf};

use libcasr::error::Error;
Expand Down Expand Up @@ -259,7 +258,7 @@ fn main() -> Result<()> {
"Ulimit is set to 0. Set ulimit greater than zero to analyze coredumps. Casr command line: {}",
&casr_cmd
);
drop(lockfile.unwrap());
let _ = lockfile.unwrap().unlock();
bail!(
"Ulimit is set to 0. Set ulimit greater than zero to analyze coredumps. Casr command line: {}",
&casr_cmd
Expand Down Expand Up @@ -297,7 +296,7 @@ fn main() -> Result<()> {
result.as_ref().err().unwrap(),
&casr_cmd
);
drop(lockfile.unwrap());
let _ = lockfile.unwrap().unlock();
bail!(
"Coredump analysis error: {}. Casr command line: {}",
result.as_ref().err().unwrap(),
Expand All @@ -316,21 +315,22 @@ fn main() -> Result<()> {
} else {
error!("Couldn't write report file: {}", report_path.display());
}
drop(lockfile.unwrap());
let _ = lockfile.unwrap().unlock();
Ok(())
}

/// Method checks mutex.
fn check_lock() -> Result<File> {
fn check_lock() -> Result<Flock<File>> {
let mut project_dir = PathBuf::from("/var/crash/");
project_dir.push("Casr.lock");
let file = OpenOptions::new()
.create(true)
.append(true)
.open(project_dir)?;
let fd = file.as_raw_fd();
flock(fd, FlockArg::LockExclusive).unwrap();
Ok(file)
match Flock::lock(file, FlockArg::LockExclusive) {
Ok(l) => Ok(l),
Err((_, errno)) => Err(errno.into()),
}
}

/// Analyze coredump and put information to report.
Expand Down
5 changes: 4 additions & 1 deletion casr/src/bin/casr-java.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ fn main() -> Result<()> {
let java_stderr_list: Vec<String> = java_stderr.split('\n').map(|l| l.to_string()).collect();
let re = Regex::new(r"Exception in thread .*? |== Java Exception: ").unwrap();
if let Some(start) = java_stderr_list.iter().position(|x| re.is_match(x)) {
report.java_report = java_stderr_list[start..].to_vec();
report.java_report = java_stderr_list[start..]
.iter()
.map(|line| line.replace('\t', " "))
.collect();
if let Some(end) = report
.java_report
.iter()
Expand Down
8 changes: 4 additions & 4 deletions libcasr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ exclude = ["/fuzz"]

[dependencies]
regex = "1"
lazy_static = "1.4"
goblin = { version = "0.8", optional = true }
capstone = { version = "0.12", optional = true }
lazy_static = "1.5"
goblin = { version = "0.9", optional = true }
capstone = { version = "0.13", optional = true }
chrono = "0.4"
serde = { version = "1.0", features = ["derive"], optional = true }
serde_json = { version = "1.0", optional = true }
lexiclean = { version = "0.0", optional = true }
gdb-command = "0.7"
thiserror = "1.0"
thiserror = "2.0"
kodama = "0.3"

[features]
Expand Down
9 changes: 7 additions & 2 deletions libcasr/src/execution_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,15 +559,20 @@ impl ExecutionClass {
}
impl fmt::Display for ExecutionClass {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let description = if !self.description.is_empty() {
format!("\nDescription: {}", self.description)
} else {
"".to_string()
};
let explanation = if !self.explanation.is_empty() {
format!("\nExplanation: {}", self.explanation)
} else {
"".to_string()
};
write!(
f,
"Severity: {}\nShort description: {}\nDescription: {}{}",
self.severity, self.short_description, self.description, explanation
"Severity: {}\nShort description: {}{}{}",
self.severity, self.short_description, description, explanation
)
}
}
Expand Down
5 changes: 4 additions & 1 deletion libcasr/src/java.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ impl ParseStacktrace for JavaStacktrace {
return Err(Error::Casr("Empty stacktrace.".to_string()));
}

Ok(forward_stacktrace.iter().map(|x| x.to_string()).collect())
Ok(forward_stacktrace
.iter()
.map(|x| x.trim().to_string())
.collect())
}

fn parse_stacktrace_entry(entry: &str) -> Result<StacktraceEntry> {
Expand Down

0 comments on commit 5c3d818

Please sign in to comment.