summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/analysis')
-rw-r--r--plugins/pychrysalide/analysis/block.c6
-rw-r--r--plugins/pychrysalide/analysis/content.c45
-rw-r--r--plugins/pychrysalide/analysis/db/items/bookmark.c18
-rw-r--r--plugins/pychrysalide/analysis/db/items/comment.c14
4 files changed, 64 insertions, 19 deletions
diff --git a/plugins/pychrysalide/analysis/block.c b/plugins/pychrysalide/analysis/block.c
index e282d14..7e6b109 100644
--- a/plugins/pychrysalide/analysis/block.c
+++ b/plugins/pychrysalide/analysis/block.c
@@ -399,7 +399,7 @@ int convert_to_code_block(PyObject *arg, void *dst)
static PyObject *py_block_list_find_by_addr(PyObject *self, PyObject *args)
{
PyObject *result; /* Conclusion à retourner */
- vmpa2t addr; /* Emplacement ciblé */
+ vmpa2t *addr; /* Emplacement ciblé */
int ret; /* Bilan de lecture des args. */
GBlockList *list; /* Liste de blocs manipulée */
GCodeBlock *found; /* Eventuel bloc trouvé */
@@ -409,7 +409,7 @@ static PyObject *py_block_list_find_by_addr(PyObject *self, PyObject *args)
list = G_BLOCK_LIST(pygobject_get(self));
- found = g_block_list_find_by_addr(list, &addr);
+ found = g_block_list_find_by_addr(list, addr);
if (found != NULL)
{
@@ -422,6 +422,8 @@ static PyObject *py_block_list_find_by_addr(PyObject *self, PyObject *args)
Py_INCREF(result);
}
+ clean_vmpa_arg(addr);
+
return result;
}
diff --git a/plugins/pychrysalide/analysis/content.c b/plugins/pychrysalide/analysis/content.c
index 93292fb..8934c88 100644
--- a/plugins/pychrysalide/analysis/content.c
+++ b/plugins/pychrysalide/analysis/content.c
@@ -155,7 +155,7 @@ static PyObject *py_binary_content_describe(PyObject *self, PyObject *args)
static PyObject *py_binary_content_read_raw(PyObject *self, PyObject *args)
{
PyObject *result; /* Instance à retourner */
- vmpa2t addr; /* Position interne associée */
+ vmpa2t *addr; /* Position interne associée */
unsigned long long length; /* Quantité de données à lire */
int ret; /* Bilan de lecture des args. */
GBinContent *content; /* Version GLib du format */
@@ -173,15 +173,20 @@ static PyObject *py_binary_content_read_raw(PyObject *self, PyObject *args)
content = G_BIN_CONTENT(pygobject_get(self));
- val = g_binary_content_get_raw_access(content, &addr, length);
+ val = g_binary_content_get_raw_access(content, addr, length);
if (val == NULL)
{
+ clean_vmpa_arg(addr);
+
PyErr_SetString(PyExc_Exception, _("Invalid read access."));
return NULL;
+
}
result = PyBytes_FromStringAndSize((char *)val, length);
+ clean_vmpa_arg(addr);
+
return result;
}
@@ -203,7 +208,7 @@ static PyObject *py_binary_content_read_raw(PyObject *self, PyObject *args)
static PyObject *py_binary_content_read_u8(PyObject *self, PyObject *args)
{
PyObject *result; /* Instance à retourner */
- vmpa2t addr; /* Position interne associée */
+ vmpa2t *addr; /* Position interne associée */
int ret; /* Bilan de lecture des args. */
GBinContent *content; /* Version GLib du format */
uint8_t val; /* Valeur lue à faire suivre */
@@ -221,15 +226,20 @@ static PyObject *py_binary_content_read_u8(PyObject *self, PyObject *args)
content = G_BIN_CONTENT(pygobject_get(self));
- status = g_binary_content_read_u8(content, &addr, &val);
+ status = g_binary_content_read_u8(content, addr, &val);
if (!status)
{
+ clean_vmpa_arg(addr);
+
PyErr_SetString(PyExc_Exception, _("Invalid read access."));
return NULL;
+
}
result = PyLong_FromUnsignedLong(val);
+ clean_vmpa_arg(addr);
+
return result;
}
@@ -251,7 +261,7 @@ static PyObject *py_binary_content_read_u8(PyObject *self, PyObject *args)
static PyObject *py_binary_content_read_u16(PyObject *self, PyObject *args)
{
PyObject *result; /* Instance à retourner */
- vmpa2t addr; /* Position interne associée */
+ vmpa2t *addr; /* Position interne associée */
unsigned long endianness; /* Boutisme de la lecture */
int ret; /* Bilan de lecture des args. */
GBinContent *content; /* Version GLib du format */
@@ -273,15 +283,20 @@ static PyObject *py_binary_content_read_u16(PyObject *self, PyObject *args)
content = G_BIN_CONTENT(pygobject_get(self));
- status = g_binary_content_read_u16(content, &addr, endianness, &val);
+ status = g_binary_content_read_u16(content, addr, endianness, &val);
if (!status)
{
+ clean_vmpa_arg(addr);
+
PyErr_SetString(PyExc_Exception, _("Invalid read access."));
return NULL;
+
}
result = PyLong_FromUnsignedLong(val);
+ clean_vmpa_arg(addr);
+
return result;
}
@@ -303,7 +318,7 @@ static PyObject *py_binary_content_read_u16(PyObject *self, PyObject *args)
static PyObject *py_binary_content_read_u32(PyObject *self, PyObject *args)
{
PyObject *result; /* Instance à retourner */
- vmpa2t addr; /* Position interne associée */
+ vmpa2t *addr; /* Position interne associée */
unsigned long endianness; /* Boutisme de la lecture */
int ret; /* Bilan de lecture des args. */
GBinContent *content; /* Version GLib du format */
@@ -325,15 +340,20 @@ static PyObject *py_binary_content_read_u32(PyObject *self, PyObject *args)
content = G_BIN_CONTENT(pygobject_get(self));
- status = g_binary_content_read_u32(content, &addr, endianness, &val);
+ status = g_binary_content_read_u32(content, addr, endianness, &val);
if (!status)
{
+ clean_vmpa_arg(addr);
+
PyErr_SetString(PyExc_Exception, _("Invalid read access."));
return NULL;
+
}
result = PyLong_FromUnsignedLong(val);
+ clean_vmpa_arg(addr);
+
return result;
}
@@ -354,7 +374,7 @@ static PyObject *py_binary_content_read_u32(PyObject *self, PyObject *args)
static PyObject *py_binary_content_read_u64(PyObject *self, PyObject *args)
{
PyObject *result; /* Instance à retourner */
- vmpa2t addr; /* Position interne associée */
+ vmpa2t *addr; /* Position interne associée */
unsigned long endianness; /* Boutisme de la lecture */
int ret; /* Bilan de lecture des args. */
GBinContent *content; /* Version GLib du format */
@@ -376,15 +396,20 @@ static PyObject *py_binary_content_read_u64(PyObject *self, PyObject *args)
content = G_BIN_CONTENT(pygobject_get(self));
- status = g_binary_content_read_u64(content, &addr, endianness, &val);
+ status = g_binary_content_read_u64(content, addr, endianness, &val);
if (!status)
{
+ clean_vmpa_arg(addr);
+
PyErr_SetString(PyExc_Exception, _("Invalid read access."));
return NULL;
+
}
result = PyLong_FromUnsignedLongLong(val);
+ clean_vmpa_arg(addr);
+
return result;
}
diff --git a/plugins/pychrysalide/analysis/db/items/bookmark.c b/plugins/pychrysalide/analysis/db/items/bookmark.c
index 468f38c..547d8f1 100644
--- a/plugins/pychrysalide/analysis/db/items/bookmark.c
+++ b/plugins/pychrysalide/analysis/db/items/bookmark.c
@@ -148,7 +148,7 @@ static PyObject *py_db_bookmark_new(PyTypeObject *type, PyObject *args, PyObject
static int py_db_bookmark_init(PyObject *self, PyObject *args, PyObject *kwds)
{
int result; /* Bilan à renvoyer */
- vmpa2t addr; /* Emplacement ciblé */
+ vmpa2t *addr; /* Emplacement ciblé */
const char *comment; /* Commentaire éventuel associé*/
int ret; /* Bilan de lecture des args. */
PyObject *new_args; /* Nouveaux arguments épurés */
@@ -190,14 +190,24 @@ static int py_db_bookmark_init(PyObject *self, PyObject *args, PyObject *kwds)
Py_DECREF(new_kwds);
Py_DECREF(new_args);
- if (ret == -1) goto exit;
+ if (ret == -1)
+ {
+ clean_vmpa_arg(addr);
+ goto exit;
+ }
/* Eléments de base */
bookmark = G_DB_BOOKMARK(pygobject_get(self));
- status = g_db_bookmark_fill(bookmark, &addr, comment);
- if (!status) goto exit;
+ status = g_db_bookmark_fill(bookmark, addr, comment);
+ if (!status)
+ {
+ clean_vmpa_arg(addr);
+ goto exit;
+ }
+
+ clean_vmpa_arg(addr);
result = 0;
diff --git a/plugins/pychrysalide/analysis/db/items/comment.c b/plugins/pychrysalide/analysis/db/items/comment.c
index 6d05403..6a9f990 100644
--- a/plugins/pychrysalide/analysis/db/items/comment.c
+++ b/plugins/pychrysalide/analysis/db/items/comment.c
@@ -71,7 +71,7 @@ static PyObject *py_db_comment_new(PyTypeObject *type, PyObject *args, PyObject
int repeatable; /* Note une répétition demandée*/
const char *text; /* Eventuel premier commentaire*/
int before; /* Indication sur l'emplacement*/
- vmpa2t addr; /* Emplacement ciblé */
+ vmpa2t *addr; /* Emplacement ciblé */
unsigned long flags; /* Identifiants de ligne visée */
int ret; /* Bilan de lecture des args. */
GDbComment *comment; /* Version GLib du commentaire */
@@ -92,26 +92,34 @@ static PyObject *py_db_comment_new(PyTypeObject *type, PyObject *args, PyObject
if (flags > BLF_ALL)
{
+ clean_vmpa_arg(addr);
+
PyErr_SetString(PyExc_ValueError, _("Invalid flag combination"));
return NULL;
+
}
if ((repeatable == -1 && before == -1) || (repeatable != -1 && before != -1))
{
+ clean_vmpa_arg(addr);
+
PyErr_SetString(PyExc_ValueError, _("repeatable or before has to be defined"));
return NULL;
+
}
/* Construction */
if (repeatable)
- comment = g_db_comment_new_inlined(&addr, flags, repeatable);
+ comment = g_db_comment_new_inlined(addr, flags, repeatable);
else
- comment = g_db_comment_new_area(&addr, flags, text, before);
+ comment = g_db_comment_new_area(addr, flags, text, before);
result = pygobject_new(G_OBJECT(comment));
g_object_unref(comment);
+ clean_vmpa_arg(addr);
+
return result;
}