From d739070b26bdfb63686e5652d0427944f0c48e0e Mon Sep 17 00:00:00 2001 From: Artem Chaikin Date: Fri, 18 Oct 2024 16:42:21 +0100 Subject: [PATCH] add size_t to reinterpret_cast rule --- assets/semgrep_rules/client/reinterpret_cast.cpp | 2 ++ assets/semgrep_rules/client/reinterpret_cast.yaml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/semgrep_rules/client/reinterpret_cast.cpp b/assets/semgrep_rules/client/reinterpret_cast.cpp index a0a4f47a..78f608d6 100644 --- a/assets/semgrep_rules/client/reinterpret_cast.cpp +++ b/assets/semgrep_rules/client/reinterpret_cast.cpp @@ -10,3 +10,5 @@ int rv = PKCS5_PBKDF2_HMAC(mnemonic.data(), mnemonic.length(), reinterpret_cast< float* float_data = reinterpret_cast(const_cast(data)); // ok: reinterpret_cast auto orig_fn = reinterpret_cast(g_originals.functions[GET_MODULE_FILENAME_EX_W_ID]); +// ruleid: reinterpret_cast +size_t bytes_read = reinterpret_cast(arg0); diff --git a/assets/semgrep_rules/client/reinterpret_cast.yaml b/assets/semgrep_rules/client/reinterpret_cast.yaml index aeb8ccbf..6f950c50 100644 --- a/assets/semgrep_rules/client/reinterpret_cast.yaml +++ b/assets/semgrep_rules/client/reinterpret_cast.yaml @@ -16,4 +16,4 @@ rules: - pattern: reinterpret_cast<$T>($ARG) - metavariable-regex: metavariable: $T - regex: ^(.*int.*|.*double.*|.*float.*|.*char.*)$ # this probably needs to be tweaked + regex: ^(.*int.*|.*double.*|.*float.*|.*char.*|.*size_t.*)$ # this probably needs to be tweaked