Show gcc version and improve checks in RSign.dbType()

This commit is contained in:
pancake 2023-08-18 12:36:52 +02:00 committed by GitHub
parent 4746c14fd4
commit 779698ead0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -77,6 +77,7 @@ jobs:
uses: actions/checkout@v3
- name: Packaging for Debian
run: |
gcc -v
export CFLAGS="-Werror"
sys/debian.sh
- name: Pub
@ -95,8 +96,7 @@ jobs:
sudo apt update --assume-yes
sudo apt install --assume-yes gcc-aarch64-linux-gnu
- name: Packaging for Debian
run: |
sys/debian.sh arm64
run: gcc -v ; sys/debian.sh arm64
- name: Pub
uses: actions/upload-artifact@v3
with:

View File

@ -2965,6 +2965,7 @@ enum {
};
static int signdb_type(const char *file) {
char *data = NULL;
if (r_str_endswith (file, ".sdb")) {
return SIGNDB_TYPE_SDB;
}
@ -2977,11 +2978,12 @@ static int signdb_type(const char *file) {
if (r_str_endswith (file, ".r2")) {
return SIGNDB_TYPE_R2;
}
int i, sz;
char *data = r_file_slurp_range (file, 0, 0x200, &sz);
if (!data) {
int i, sz = 0;
data = r_file_slurp_range (file, 0, 0x200, &sz);
if (!data || sz < 1) {
return SIGNDB_TYPE_INVALID;
}
sz = R_MIN (sz, 0x200);
int is_sdb = 16;
int is_kv = 4;
int is_r2 = 4;
@ -3023,7 +3025,11 @@ static int signdb_type(const char *file) {
t = SIGNDB_TYPE_KV;
}
}
free ((void*)data);
// XXX looks like a false positive bug in gcc 9.4 (debian CI)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfree-nonheap-object"
free (data);
#pragma GCC diagnostic pop
return t;
}
@ -3194,7 +3200,6 @@ R_API bool r_sign_load(RAnal *a, const char *file, bool merge) {
R_LOG_ERROR ("Unsupported signature file format");
break;
}
// TODO: check if file is an r2 script, sdb database, keyvalue plaintext or json
free (path);
return res;
}
@ -3293,5 +3298,5 @@ R_API RSignOptions *r_sign_options_new(const char *bytes_thresh, const char *gra
}
R_API void r_sign_options_free(RSignOptions *options) {
R_FREE (options);
free (options);
}