diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1527d6a5d00..bdf2658b080 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: compiler: clang run_tests: true meson_options: -Dbuildtype=release - enabled: ${{ github.event_name != 'pull_request' && needs.changes.outputs.edited == 'true' }} + enabled: ${{ (github.event_name != 'pull_request' || contains(github.head_ref, 'clang')) && needs.changes.outputs.edited == 'true' }} timeout: 45 allow_failure: false - name: linux-meson-gcc-tests diff --git a/librz/include/rz_util/rz_hex.h b/librz/include/rz_util/rz_hex.h index b8c514588f4..faca386cc48 100644 --- a/librz/include/rz_util/rz_hex.h +++ b/librz/include/rz_util/rz_hex.h @@ -9,7 +9,7 @@ RZ_API int rz_hex_pair2bin(const char *arg); RZ_API int rz_hex_str2binmask(const char *in, ut8 *out, ut8 *mask); RZ_API int rz_hex_str2bin(const char *in, ut8 *out); RZ_API int rz_hex_bin2str(const ut8 *in, int len, char *out); -RZ_API void rz_hex_ut2st_str(const ut64 in, RZ_INOUT char *out, const int len); +RZ_API void rz_hex_ut2st_str(const ut32 in, RZ_INOUT char *out, const int len); RZ_API char *rz_hex_bin2strdup(const ut8 *in, int len); RZ_API bool rz_hex_to_byte(ut8 *val, ut8 c); RZ_API int rz_hex_str_is_valid(const char *s); diff --git a/librz/util/hex.c b/librz/util/hex.c index bd6926981c9..1da7df7e040 100644 --- a/librz/util/hex.c +++ b/librz/util/hex.c @@ -394,21 +394,21 @@ RZ_API int rz_hex_bin2str(const ut8 *in, int len, char *out) { } /** - * \brief Takes an unsigned integer and returns the signed integer in hex format as string. - * E.g.: 0xffffffffffffffff -> "-0x1" + * \brief Takes an unsigned 32bit integer with MSB set to 1 and returns the signed integer in hex format as string. + * E.g.: 0xffffffff -> "-0x1" * * \param in The integer to convert to the signed string. * \param out The buffer to write the signed hex string to. * \param len Length of the out buffer. * \return char* The signed integer as hex string. */ -RZ_API void rz_hex_ut2st_str(const ut64 in, RZ_INOUT char *out, const int len) { - if (len < 20) { - RZ_LOG_FATAL("Output buffer too small for 64bit value.\n"); +RZ_API void rz_hex_ut2st_str(const ut32 in, RZ_INOUT char *out, const int len) { + char tmp[12]; + if (len < sizeof(tmp)) { + RZ_LOG_FATAL("Output buffer too small for negative 32bit value.\n"); } - char tmp[20]; - sprintf(tmp, "-0x%x", abs((st64)in)); - memcpy(out, tmp, 20); + snprintf(tmp, sizeof(tmp), "-0x%" PFMT32x, ~in + 1); + memcpy(out, tmp, sizeof(tmp)); return; }