summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2017-01-30 06:42:00 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2017-01-30 07:11:03 (GMT)
commitcb959f75e36fbc08105fdc311fddd50516c5f1d8 (patch) (side-by-side diff)
tree5121c771dca5ead89a4802bf38039ea4c990bae7
parent9a286d24b51ab106db6fe389767d79d3f5dea159 (diff)
downloadidest-cb959f75e36fbc08105fdc311fddd50516c5f1d8.tar.gz
idest-cb959f75e36fbc08105fdc311fddd50516c5f1d8.tar.bz2
Bugfix
* libid3tag/tag.c (v1_render): Fix coredump on NULL TRCK value.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libid3tag/frame.c5
-rw-r--r--libid3tag/tag.c17
2 files changed, 11 insertions, 11 deletions
diff --git a/libid3tag/frame.c b/libid3tag/frame.c
index 21f987a..4b24a7d 100644
--- a/libid3tag/frame.c
+++ b/libid3tag/frame.c
@@ -256,9 +256,8 @@ parse_data(struct id3_frame *frame,
end = data + length;
for (i = 0; i < frame->nfields; ++i) {
- if (id3_field_parse
- (&frame->fields[i], &data, end - data,
- &encoding) == -1)
+ if (id3_field_parse(&frame->fields[i], &data, end - data,
+ &encoding) == -1)
return -1;
}
diff --git a/libid3tag/tag.c b/libid3tag/tag.c
index 4473bcc..80e59b8 100644
--- a/libid3tag/tag.c
+++ b/libid3tag/tag.c
@@ -779,14 +779,15 @@ v1_render(struct id3_tag const *tag, id3_byte_t * buffer)
frame = id3_tag_findframe(tag, ID3_FRAME_TRACK, 0);
if (frame) {
- unsigned int track;
-
- track =
- id3_ucs4_getnumber(id3_field_getstrings
- (&frame->fields[1], 0));
- if (track > 0 && track <= 0xff) {
- ptr[-2] = 0;
- ptr[-1] = track;
+ id3_ucs4_t const *s;
+
+ s = id3_field_getstrings(&frame->fields[1], 0);
+ if (s) {
+ unsigned int track = id3_ucs4_getnumber(s);
+ if (track > 0 && track <= 0xff) {
+ ptr[-2] = 0;
+ ptr[-1] = track;
+ }
}
}

Return to:

Send suggestions and report system problems to the System administrator.