From 264ba85bbff7808b27e21298a532cf538641bac4 Mon Sep 17 00:00:00 2001 From: Vincent Thiberville Date: Sat, 1 Jun 2024 17:06:35 +0200 Subject: [PATCH] update yara to 4.5.1 --- .github/workflows/release.yaml | 2 +- .github/workflows/tests.yml | 8 +-- Cargo.toml | 4 +- yara-sys/Cargo.toml | 4 +- yara-sys/README.md | 6 +- ...n.rs => yara-4.5.1-x86_64-apple-darwin.rs} | 67 +++++++++++-------- ...rs => yara-4.5.1-x86_64-pc-windows-gnu.rs} | 11 +++ ...s => yara-4.5.1-x86_64-pc-windows-msvc.rs} | 11 +++ ...=> yara-4.5.1-x86_64-unknown-linux-gnu.rs} | 11 +++ ...> yara-4.5.1-x86_64-unknown-linux-musl.rs} | 11 +++ yara-sys/build.rs | 6 +- yara-sys/yara | 2 +- 12 files changed, 99 insertions(+), 44 deletions(-) rename yara-sys/bindings/{yara-4.5.0-x86_64-apple-darwin.rs => yara-4.5.1-x86_64-apple-darwin.rs} (99%) rename yara-sys/bindings/{yara-4.5.0-x86_64-pc-windows-gnu.rs => yara-4.5.1-x86_64-pc-windows-gnu.rs} (99%) rename yara-sys/bindings/{yara-4.5.0-x86_64-pc-windows-msvc.rs => yara-4.5.1-x86_64-pc-windows-msvc.rs} (99%) rename yara-sys/bindings/{yara-4.5.0-x86_64-unknown-linux-musl.rs => yara-4.5.1-x86_64-unknown-linux-gnu.rs} (99%) rename yara-sys/bindings/{yara-4.5.0-x86_64-unknown-linux-gnu.rs => yara-4.5.1-x86_64-unknown-linux-musl.rs} (99%) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 26c1a54..c65153f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -33,7 +33,7 @@ jobs: override: true - uses: katyo/publish-crates@v1 with: - args: "--features bundled-4_5_0" + args: "--features bundled-4_5_1" dry-run: ${{ github.event.inputs.dry_run }} registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a4da000..f583e5b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,14 +26,14 @@ jobs: - name: Cargo fmt run: cargo fmt --all -- --check - name: Cargo clippy - run: cargo clippy --features bindgen,bundled-4_5_0,vendored -- -D warnings + run: cargo clippy --features bindgen,bundled-4_5_1,vendored -- -D warnings test-posix: strategy: matrix: os: [ ubuntu-latest ] target: ["x86_64-unknown-linux-musl", "x86_64-unknown-linux-gnu"] - features: [ "vendored,bindgen", "vendored,bundled-4_5_0" ] + features: [ "vendored,bindgen", "vendored,bundled-4_5_1" ] rust: [ stable, nightly ] runs-on: ${{ matrix.os }} @@ -54,7 +54,7 @@ jobs: strategy: matrix: os: [ windows-2019 ] - features: [ "vendored,bundled-4_5_0" ] + features: [ "vendored,bundled-4_5_1" ] rust: [ stable ] cryptolib: [ "WinCrypt", "disabled" ] @@ -81,7 +81,7 @@ jobs: strategy: matrix: os: [ macos-13 ] - features: [ "vendored,bindgen", "vendored,bundled-4_5_0" ] + features: [ "vendored,bindgen", "vendored,bundled-4_5_1" ] rust: [ stable, nightly ] cryptolib: [ "OpenSSL", "CommonCrypto", "disabled" ] openssl_dir: [ "/usr/local/opt/openssl@1.1" ] diff --git a/Cargo.toml b/Cargo.toml index b4b5728..a5e98c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ rust-version = "1.63" [features] default = ["bindgen", 'module-dotnet', 'module-dex', 'module-macho', 'module-hash', 'ndebug'] bindgen = ["yara-sys/bindgen"] -bundled-4_5_0 = ["yara-sys/bundled-4_5_0"] +bundled-4_5_1 = ["yara-sys/bundled-4_5_1"] vendored = ["yara-sys/vendored"] module-cuckoo = ["yara-sys/module-cuckoo"] module-magic = ["yara-sys/module-magic"] @@ -48,4 +48,4 @@ default-features = false [package.metadata.docs.rs] no-default-features = true -features = ["bundled-4_5_0"] +features = ["bundled-4_5_1"] diff --git a/yara-sys/Cargo.toml b/yara-sys/Cargo.toml index a276f60..0629b8a 100644 --- a/yara-sys/Cargo.toml +++ b/yara-sys/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" [features] default = ["bindgen", 'module-dotnet', 'module-dex', 'module-macho', 'module-hash', 'ndebug'] -bundled-4_5_0 = [] +bundled-4_5_1 = [] vendored = ["cc", "glob", "fs_extra"] module-cuckoo = [] module-magic = [] @@ -35,4 +35,4 @@ fs_extra = { version = "1.2", optional = true } [package.metadata.docs.rs] no-default-features = true -features = ["bundled-4_5_0"] +features = ["bundled-4_5_1"] diff --git a/yara-sys/README.md b/yara-sys/README.md index 95faafd..b4018f5 100644 --- a/yara-sys/README.md +++ b/yara-sys/README.md @@ -16,8 +16,8 @@ version of Yara. Just make sure the version you specify is the same that the version on your system! - `bindgen`: **recommended**: this is the default feature, to use generated bindings. -- `vendored`: automatically compile and link libyara v4.5.0. -- `bundled-4_5_0`: use pre-generated bindings for Yara 4.5.0. Useful if you do not +- `vendored`: automatically compile and link libyara v4.5.1. +- `bundled-4_5_1`: use pre-generated bindings for Yara 4.5.1. Useful if you do not want to install LLVM to run bindgen. However, you'll have to make sure you use a version of Yara with the same major and minor version number. List of supported targets: - x86_64-apple-darwin @@ -38,7 +38,7 @@ You can specify the following environment variables: You can also specify the `yara-static` feature to link Yara statically rather than dynamically. -## Compile options for libyara v4.5.0 +## Compile options for libyara v4.5.1 When using the `vendored` feature, Yara will be automatically built and linked statically with yara-sys. diff --git a/yara-sys/bindings/yara-4.5.0-x86_64-apple-darwin.rs b/yara-sys/bindings/yara-4.5.1-x86_64-apple-darwin.rs similarity index 99% rename from yara-sys/bindings/yara-4.5.0-x86_64-apple-darwin.rs rename to yara-sys/bindings/yara-4.5.1-x86_64-apple-darwin.rs index 7159823..9ae7a9e 100644 --- a/yara-sys/bindings/yara-4.5.0-x86_64-apple-darwin.rs +++ b/yara-sys/bindings/yara-4.5.1-x86_64-apple-darwin.rs @@ -129,7 +129,7 @@ pub const OBJECT_TYPE_ARRAY: u32 = 4; pub const OBJECT_TYPE_FUNCTION: u32 = 5; pub const OBJECT_TYPE_DICTIONARY: u32 = 6; pub const OBJECT_TYPE_FLOAT: u32 = 7; -pub type jmp_buf = [::std::os::raw::c_int; 37usize]; +pub type jmp_buf = [::std::os::raw::c_int; 48usize]; pub type __int64_t = ::std::os::raw::c_longlong; pub type __darwin_size_t = ::std::os::raw::c_ulong; pub type __darwin_off_t = __int64_t; @@ -1443,6 +1443,7 @@ pub struct YR_RULE { pub flags: i32, pub num_atoms: i32, pub required_strings: u32, + pub unused: u32, pub __bindgen_anon_1: YR_RULE__bindgen_ty_1, pub __bindgen_anon_2: YR_RULE__bindgen_ty_2, pub __bindgen_anon_3: YR_RULE__bindgen_ty_3, @@ -1703,6 +1704,16 @@ fn bindgen_test_layout_YR_RULE() { stringify!(required_strings) ) ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).unused) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(YR_RULE), + "::", + stringify!(unused) + ) + ); } #[repr(C)] #[derive(Copy, Clone)] @@ -4755,7 +4766,7 @@ fn bindgen_test_layout__YR_COMPILER() { let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_YR_COMPILER>(), - 10408usize, + 10456usize, concat!("Size of: ", stringify!(_YR_COMPILER)) ); assert_eq!( @@ -4895,7 +4906,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).automaton) as usize - ptr as usize }, - 208usize, + 256usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -4905,7 +4916,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).rules_table) as usize - ptr as usize }, - 216usize, + 264usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -4915,7 +4926,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).objects_table) as usize - ptr as usize }, - 224usize, + 272usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -4925,7 +4936,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).strings_table) as usize - ptr as usize }, - 232usize, + 280usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -4935,7 +4946,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).wildcard_identifiers_table) as usize - ptr as usize }, - 240usize, + 288usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -4945,7 +4956,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).sz_table) as usize - ptr as usize }, - 248usize, + 296usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -4955,7 +4966,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).fixup_stack_head) as usize - ptr as usize }, - 256usize, + 304usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -4965,7 +4976,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).num_namespaces) as usize - ptr as usize }, - 264usize, + 312usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -4975,7 +4986,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).loop_) as usize - ptr as usize }, - 272usize, + 320usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -4985,7 +4996,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).loop_index) as usize - ptr as usize }, - 688usize, + 736usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -4995,7 +5006,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).loop_for_of_var_index) as usize - ptr as usize }, - 692usize, + 740usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5005,7 +5016,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).file_name_stack) as usize - ptr as usize }, - 696usize, + 744usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5015,7 +5026,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).file_name_stack_ptr) as usize - ptr as usize }, - 824usize, + 872usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5025,7 +5036,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).last_error_extra_info) as usize - ptr as usize }, - 828usize, + 876usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5035,7 +5046,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).lex_buf) as usize - ptr as usize }, - 1084usize, + 1132usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5045,7 +5056,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).lex_buf_ptr) as usize - ptr as usize }, - 9280usize, + 9328usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5055,7 +5066,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).lex_buf_len) as usize - ptr as usize }, - 9288usize, + 9336usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5065,7 +5076,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).include_base_dir) as usize - ptr as usize }, - 9290usize, + 9338usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5075,7 +5086,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).user_data) as usize - ptr as usize }, - 10320usize, + 10368usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5085,7 +5096,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).incl_clbk_user_data) as usize - ptr as usize }, - 10328usize, + 10376usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5095,7 +5106,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).re_ast_clbk_user_data) as usize - ptr as usize }, - 10336usize, + 10384usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5105,7 +5116,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).callback) as usize - ptr as usize }, - 10344usize, + 10392usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5115,7 +5126,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).include_callback) as usize - ptr as usize }, - 10352usize, + 10400usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5125,7 +5136,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).include_free) as usize - ptr as usize }, - 10360usize, + 10408usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5135,7 +5146,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).re_ast_callback) as usize - ptr as usize }, - 10368usize, + 10416usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), @@ -5145,7 +5156,7 @@ fn bindgen_test_layout__YR_COMPILER() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).atoms_config) as usize - ptr as usize }, - 10376usize, + 10424usize, concat!( "Offset of field: ", stringify!(_YR_COMPILER), diff --git a/yara-sys/bindings/yara-4.5.0-x86_64-pc-windows-gnu.rs b/yara-sys/bindings/yara-4.5.1-x86_64-pc-windows-gnu.rs similarity index 99% rename from yara-sys/bindings/yara-4.5.0-x86_64-pc-windows-gnu.rs rename to yara-sys/bindings/yara-4.5.1-x86_64-pc-windows-gnu.rs index 902fa0d..a23e87c 100644 --- a/yara-sys/bindings/yara-4.5.0-x86_64-pc-windows-gnu.rs +++ b/yara-sys/bindings/yara-4.5.1-x86_64-pc-windows-gnu.rs @@ -4052,6 +4052,7 @@ pub struct YR_RULE { pub flags: i32, pub num_atoms: i32, pub required_strings: u32, + pub unused: u32, pub __bindgen_anon_1: YR_RULE__bindgen_ty_1, pub __bindgen_anon_2: YR_RULE__bindgen_ty_2, pub __bindgen_anon_3: YR_RULE__bindgen_ty_3, @@ -4312,6 +4313,16 @@ fn bindgen_test_layout_YR_RULE() { stringify!(required_strings) ) ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).unused) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(YR_RULE), + "::", + stringify!(unused) + ) + ); } #[repr(C)] #[derive(Copy, Clone)] diff --git a/yara-sys/bindings/yara-4.5.0-x86_64-pc-windows-msvc.rs b/yara-sys/bindings/yara-4.5.1-x86_64-pc-windows-msvc.rs similarity index 99% rename from yara-sys/bindings/yara-4.5.0-x86_64-pc-windows-msvc.rs rename to yara-sys/bindings/yara-4.5.1-x86_64-pc-windows-msvc.rs index 902fa0d..a23e87c 100644 --- a/yara-sys/bindings/yara-4.5.0-x86_64-pc-windows-msvc.rs +++ b/yara-sys/bindings/yara-4.5.1-x86_64-pc-windows-msvc.rs @@ -4052,6 +4052,7 @@ pub struct YR_RULE { pub flags: i32, pub num_atoms: i32, pub required_strings: u32, + pub unused: u32, pub __bindgen_anon_1: YR_RULE__bindgen_ty_1, pub __bindgen_anon_2: YR_RULE__bindgen_ty_2, pub __bindgen_anon_3: YR_RULE__bindgen_ty_3, @@ -4312,6 +4313,16 @@ fn bindgen_test_layout_YR_RULE() { stringify!(required_strings) ) ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).unused) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(YR_RULE), + "::", + stringify!(unused) + ) + ); } #[repr(C)] #[derive(Copy, Clone)] diff --git a/yara-sys/bindings/yara-4.5.0-x86_64-unknown-linux-musl.rs b/yara-sys/bindings/yara-4.5.1-x86_64-unknown-linux-gnu.rs similarity index 99% rename from yara-sys/bindings/yara-4.5.0-x86_64-unknown-linux-musl.rs rename to yara-sys/bindings/yara-4.5.1-x86_64-unknown-linux-gnu.rs index 393e13b..3328e40 100644 --- a/yara-sys/bindings/yara-4.5.0-x86_64-unknown-linux-musl.rs +++ b/yara-sys/bindings/yara-4.5.1-x86_64-unknown-linux-gnu.rs @@ -1635,6 +1635,7 @@ pub struct YR_RULE { pub flags: i32, pub num_atoms: i32, pub required_strings: u32, + pub unused: u32, pub __bindgen_anon_1: YR_RULE__bindgen_ty_1, pub __bindgen_anon_2: YR_RULE__bindgen_ty_2, pub __bindgen_anon_3: YR_RULE__bindgen_ty_3, @@ -1895,6 +1896,16 @@ fn bindgen_test_layout_YR_RULE() { stringify!(required_strings) ) ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).unused) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(YR_RULE), + "::", + stringify!(unused) + ) + ); } #[repr(C)] #[derive(Copy, Clone)] diff --git a/yara-sys/bindings/yara-4.5.0-x86_64-unknown-linux-gnu.rs b/yara-sys/bindings/yara-4.5.1-x86_64-unknown-linux-musl.rs similarity index 99% rename from yara-sys/bindings/yara-4.5.0-x86_64-unknown-linux-gnu.rs rename to yara-sys/bindings/yara-4.5.1-x86_64-unknown-linux-musl.rs index 393e13b..3328e40 100644 --- a/yara-sys/bindings/yara-4.5.0-x86_64-unknown-linux-gnu.rs +++ b/yara-sys/bindings/yara-4.5.1-x86_64-unknown-linux-musl.rs @@ -1635,6 +1635,7 @@ pub struct YR_RULE { pub flags: i32, pub num_atoms: i32, pub required_strings: u32, + pub unused: u32, pub __bindgen_anon_1: YR_RULE__bindgen_ty_1, pub __bindgen_anon_2: YR_RULE__bindgen_ty_2, pub __bindgen_anon_3: YR_RULE__bindgen_ty_3, @@ -1895,6 +1896,16 @@ fn bindgen_test_layout_YR_RULE() { stringify!(required_strings) ) ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).unused) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(YR_RULE), + "::", + stringify!(unused) + ) + ); } #[repr(C)] #[derive(Copy, Clone)] diff --git a/yara-sys/build.rs b/yara-sys/build.rs index cc025d1..7042e80 100644 --- a/yara-sys/build.rs +++ b/yara-sys/build.rs @@ -355,14 +355,14 @@ mod build { } } -#[cfg(feature = "bundled-4_5_0")] +#[cfg(feature = "bundled-4_5_1")] mod bindings { use std::env; use std::fs; use std::path::PathBuf; pub fn add_bindings() { - let binding_file = format!("yara-4.5.0-{}.rs", env::var("TARGET").unwrap()); + let binding_file = format!("yara-4.5.1-{}.rs", env::var("TARGET").unwrap()); let binding_path = PathBuf::from("bindings").join(binding_file); let out_dir = env::var("OUT_DIR").expect("$OUT_DIR should be defined"); let out_path = PathBuf::from(out_dir).join("bindings.rs"); @@ -378,7 +378,7 @@ mod bindings { } } -#[cfg(not(feature = "bundled-4_5_0"))] +#[cfg(not(feature = "bundled-4_5_1"))] mod bindings { use std::env; use std::path::PathBuf; diff --git a/yara-sys/yara b/yara-sys/yara index 8fa55cd..0e5b6bb 160000 --- a/yara-sys/yara +++ b/yara-sys/yara @@ -1 +1 @@ -Subproject commit 8fa55cde4c0cde8a1ba4ced1c131827eb4005f0d +Subproject commit 0e5b6bb9660cba500eb58dbccb027757c82cc4cf