summaryrefslogtreecommitdiff
path: root/junklib.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-04-01 16:16:42 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-04-01 16:16:42 +0200
commit31a9125937554dcf1a02be252fe174ac7ac11590 (patch)
tree77ce4c2168163862e2d3e25c8dda75bd1bacba86 /junklib.c
parent9183e3d1c54fae7be902ced6dd06f41546ec2e8e (diff)
fixed possible segfault in junk_id3v2_read_full when reading replaygain info from TXXX frame
Diffstat (limited to 'junklib.c')
-rw-r--r--junklib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/junklib.c b/junklib.c
index 66757420..735ef368 100644
--- a/junklib.c
+++ b/junklib.c
@@ -1050,10 +1050,12 @@ junk_get_leading_size (DB_FILE *fp) {
int pos = deadbeef->ftell (fp);
if (deadbeef->fread (header, 1, 10, fp) != 10) {
deadbeef->fseek (fp, pos, SEEK_SET);
+ trace ("junk_get_leading_size: file is too short\n");
return -1; // too short
}
deadbeef->fseek (fp, pos, SEEK_SET);
if (strncmp (header, "ID3", 3)) {
+ trace ("junk_get_leading_size: no id3v2 found\n");
return -1; // no tag
}
uint8_t flags = header[5];
@@ -1071,6 +1073,7 @@ junk_get_leading_size (DB_FILE *fp) {
//trace ("junklib: leading junk size %d\n", size);
return size + 10 + 10 * footerpresent;
}
+
int
junk_id3v2_unsync (uint8_t *out, int len, int maxlen) {
uint8_t buf [maxlen];
@@ -2543,7 +2546,7 @@ junk_id3v2_read_full (playItem_t *it, DB_id3v2_tag_t *tag_store, DB_FILE *fp) {
comment = newcomment;
trace ("COMM combined: %s\n", comment);
}
- else if (!strcmp (frameid, "TXXX")) {
+ else if (it && !strcmp (frameid, "TXXX")) {
if (sz < 2) {
trace ("TXXX frame is too short, skipped\n");
readptr += sz; // bad tag
@@ -2700,7 +2703,7 @@ junk_id3v2_read_full (playItem_t *it, DB_id3v2_tag_t *tag_store, DB_FILE *fp) {
comment = newcomment;
trace ("COM text: %s\n", text);
}
- else if (!strcmp (frameid, "TXX")) {
+ else if (it && !strcmp (frameid, "TXX")) {
if (sz < 2) {
trace ("TXX frame is too short, skipped\n");
readptr += sz; // bad tag