mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 11:26:11 +00:00
Return error when applying a signature fails. (#2882)
* Updated rizin commit to 8282cee287abdbf8664a0b2540bad2b5ea5b819d * Fix messages based on fail/success result while applying a sig/pat file
This commit is contained in:
parent
453974da35
commit
4f627e9bff
@ -1023,17 +1023,22 @@ void CutterCore::applySignature(const QString &filepath)
|
|||||||
const char *arch = rz_config_get(core->config, "asm.arch");
|
const char *arch = rz_config_get(core->config, "asm.arch");
|
||||||
ut8 expected_arch = rz_core_flirt_arch_from_name(arch);
|
ut8 expected_arch = rz_core_flirt_arch_from_name(arch);
|
||||||
if (expected_arch == RZ_FLIRT_SIG_ARCH_ANY && filepath.endsWith(".sig", Qt::CaseInsensitive)) {
|
if (expected_arch == RZ_FLIRT_SIG_ARCH_ANY && filepath.endsWith(".sig", Qt::CaseInsensitive)) {
|
||||||
QMessageBox::warning(
|
QMessageBox::warning(nullptr, tr("Signatures"),
|
||||||
nullptr, tr("Signatures"),
|
tr("Cannot apply signature file because the requested arch is not "
|
||||||
tr("Cannot apply signature because the requested arch is not supported by .sig "
|
"supported by .sig "
|
||||||
"files\n"));
|
"files"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
old_cnt = rz_flag_count(core->flags, "flirt");
|
old_cnt = rz_flag_count(core->flags, "flirt");
|
||||||
rz_sign_flirt_apply(core->analysis, filepath.toStdString().c_str(), expected_arch);
|
if (rz_sign_flirt_apply(core->analysis, filepath.toStdString().c_str(), expected_arch)) {
|
||||||
new_cnt = rz_flag_count(core->flags, "flirt");
|
new_cnt = rz_flag_count(core->flags, "flirt");
|
||||||
QMessageBox::information(nullptr, tr("Signatures"),
|
QMessageBox::information(nullptr, tr("Signatures"),
|
||||||
tr("Found %1 signatures!").arg(new_cnt - old_cnt));
|
tr("Found %1 matching signatures!").arg(new_cnt - old_cnt));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QMessageBox::warning(
|
||||||
|
nullptr, tr("Signatures"),
|
||||||
|
tr("Failed to apply signature file!\nPlease check the console for more details."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutterCore::createSignature(const QString &filepath)
|
void CutterCore::createSignature(const QString &filepath)
|
||||||
@ -1043,11 +1048,11 @@ void CutterCore::createSignature(const QString &filepath)
|
|||||||
if (!rz_core_flirt_create_file(core, filepath.toStdString().c_str(), &n_modules)) {
|
if (!rz_core_flirt_create_file(core, filepath.toStdString().c_str(), &n_modules)) {
|
||||||
QMessageBox::warning(
|
QMessageBox::warning(
|
||||||
nullptr, tr("Signatures"),
|
nullptr, tr("Signatures"),
|
||||||
tr("Cannot create signature file (check the console for more details).\n"));
|
tr("Cannot create signature file (check the console for more details)."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QMessageBox::information(nullptr, tr("Signatures"),
|
QMessageBox::information(nullptr, tr("Signatures"),
|
||||||
tr("Written %1 signatures to %2").arg(n_modules).arg(filepath));
|
tr("Written %1 signatures to %2.").arg(n_modules).arg(filepath));
|
||||||
}
|
}
|
||||||
|
|
||||||
ut64 CutterCore::math(const QString &expr)
|
ut64 CutterCore::math(const QString &expr)
|
||||||
|
Loading…
Reference in New Issue
Block a user