From 5fcd4f54c5ca87ca9dfd9529d7b83bbec9aff64a Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Fri, 16 Oct 2015 20:00:00 +0000 Subject: Prevented some mistakes pointed by Melkor. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@599 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 9 +++++++++ plugins/pychrysa/analysis/binary.c | 9 ++++++++- plugins/pychrysa/pychrysa.c | 2 ++ src/core/core.c | 7 +++++++ src/format/elf/section.c | 5 ++--- src/main.c | 5 ++--- 6 files changed, 30 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index d3ff736..caa76b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 15-10-16 Cyrille Bagard + * plugins/pychrysa/analysis/binary.c: + * plugins/pychrysa/pychrysa.c: + * src/core/core.c: + * src/format/elf/section.c: + * src/main.c: + Prevent some mistakes pointed by Melkor. + +15-10-16 Cyrille Bagard + * tools/ffuzzer/ffuzzer.sh: * tools/ffuzzer/process.py: Define a basic system based on Melkor to stress the disassembler and diff --git a/plugins/pychrysa/analysis/binary.c b/plugins/pychrysa/analysis/binary.c index 9e45e27..93b1c57 100644 --- a/plugins/pychrysa/analysis/binary.c +++ b/plugins/pychrysa/analysis/binary.c @@ -28,6 +28,9 @@ #include +#include + + #include @@ -82,7 +85,11 @@ static PyObject *py_loaded_binary_new(PyTypeObject *type, PyObject *args, PyObje if (!ret) return NULL; ret = PyObject_IsInstance(content_obj, (PyObject *)get_python_binary_content_type()); - if (!ret) return NULL; + if (ret == 0) + { + PyErr_SetString(PyExc_TypeError, _("Expected a BinContent as argument")); + return NULL; + } content = G_BIN_CONTENT(pygobject_get(content_obj)); binary = g_loaded_binary_new(content); diff --git a/plugins/pychrysa/pychrysa.c b/plugins/pychrysa/pychrysa.c index c77553b..d241b92 100644 --- a/plugins/pychrysa/pychrysa.c +++ b/plugins/pychrysa/pychrysa.c @@ -526,6 +526,8 @@ PyMODINIT_FUNC PyInit_pychrysalide(void) init_work_queue(NULL/* !! */); #endif + init_work_queue(NULL/* !! */); + //////////////////////// diff --git a/src/core/core.c b/src/core/core.c index accb3da..0460a23 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -24,10 +24,14 @@ #include "core.h" +#include + + #include "collections.h" #include "formats.h" #include "params.h" #include "processors.h" +#include "../gtkext/support.h" @@ -54,6 +58,9 @@ bool load_all_basic_components(void) { result = true; + add_pixmap_directory(PACKAGE_DATA_DIR); + add_pixmap_directory(PACKAGE_SOURCE_DIR G_DIR_SEPARATOR_S "pixmaps"); + result &= load_main_config_parameters(); result &= g_generic_config_read(get_main_configuration()); diff --git a/src/format/elf/section.c b/src/format/elf/section.c index 2b46d9e..60bd67a 100644 --- a/src/format/elf/section.c +++ b/src/format/elf/section.c @@ -93,9 +93,8 @@ bool find_elf_section_by_name(const GElfFormat *format, const char *name, elf_sh secname = extract_name_from_elf_string_section(format, &strings, ELF_SHDR(format, *section, sh_name)); - /* FIXME : if secname == NULL */ - - result = (strcmp(name, secname) == 0); + if (secname != NULL) + result = (strcmp(name, secname) == 0); } diff --git a/src/main.c b/src/main.c index cae6426..85e0908 100644 --- a/src/main.c +++ b/src/main.c @@ -36,7 +36,6 @@ #include "core/params.h" #include "glibext/delayed.h" #include "glibext/gbinportion.h" -#include "gtkext/support.h" #include "gtkext/theme.h" #include "plugins/pglist.h" #include "../revision.h" @@ -127,8 +126,8 @@ int main(int argc, char **argv) */ /*LIBXML_TEST_VERSION*/ - add_pixmap_directory(PACKAGE_DATA_DIR); - add_pixmap_directory(PACKAGE_SOURCE_DIR G_DIR_SEPARATOR_S "pixmaps"); + //add_pixmap_directory(PACKAGE_DATA_DIR); + //add_pixmap_directory(PACKAGE_SOURCE_DIR G_DIR_SEPARATOR_S "pixmaps"); /* Création de l'interface */ -- cgit v0.11.2-87-g4458