diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-01-27 21:32:12 +0100 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-01-27 21:32:12 +0100 |
commit | e5e4ea99ece4f9a5f764673164e4f47438eb129a (patch) | |
tree | 9610b6fc4365529e17d6ef44886d426217eae4e0 /plugins/vtx | |
parent | fdbf2d012a3be4877b8f77ff50e4c29e4c9d5a67 (diff) |
vtx: fixed crash on reading header from invalid VTX file
Diffstat (limited to 'plugins/vtx')
-rw-r--r-- | plugins/vtx/vtx.c | 1 | ||||
-rw-r--r-- | plugins/vtx/vtxfile.c | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/plugins/vtx/vtx.c b/plugins/vtx/vtx.c index 27a1f4b1..5ba72aae 100644 --- a/plugins/vtx/vtx.c +++ b/plugins/vtx/vtx.c @@ -257,6 +257,7 @@ vtx_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { trace ("vtx: failed to read header\n"); return NULL; } + printf ("hdr: %p\n", hdr); trace ("vtx: datasize: %d\n", hdr->regdata_size); DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id); diff --git a/plugins/vtx/vtxfile.c b/plugins/vtx/vtxfile.c index ff9914e6..04978a08 100644 --- a/plugins/vtx/vtxfile.c +++ b/plugins/vtx/vtxfile.c @@ -11,6 +11,9 @@ #include "ayemu.h" +//#define trace(...) { fprintf (stderr, __VA_ARGS__); } +#define trace(fmt,...) + #define AYEMU_VTX_STRING_MAX 254 typedef const char * data_ptr_t; @@ -97,7 +100,7 @@ static data_ptr_t read_header(data_ptr_t buf, ayemu_vtx_t **target, size_t size) else if (strncmp (hdr, "ym", 2) == 0) vtx->chiptype = AYEMU_YM; else { - fprintf (stderr, "File is _not_ VORTEX format!\n" + trace ("File is _not_ VORTEX format!\n" "It not begins with 'ay' or 'ym' string.\n"); goto clean_and_ret_null; } @@ -127,7 +130,7 @@ static data_ptr_t read_header(data_ptr_t buf, ayemu_vtx_t **target, size_t size) ayemu_vtx_t * ayemu_vtx_header(data_ptr_t buf, size_t size) { - ayemu_vtx_t *vtx; + ayemu_vtx_t *vtx = NULL; const char *data; |