Commit a175043b authored by Josh Coalson's avatar Josh Coalson
Browse files

fix bug #896057: parsing ISRC number from cuesheet

parent 12d7fcb8
......@@ -334,6 +334,7 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message,
track->indices[track->num_indices-1].number = in_index_num;
}
else if(0 == FLAC__STRCASECMP(field, "ISRC")) {
char *l, *r;
if(track_has_isrc) {
*error_message = "found multiple ISRC commands";
return false;
......@@ -346,6 +347,12 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message,
*error_message = "ISRC is missing ISRC number";
return false;
}
/* strip out dashes */
for(l = r = field; *r; r++) {
if(*r != '-')
*l++ = *r;
}
*l = '\0';
if(strlen(field) != 12 || strspn(field, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") < 5 || strspn(field+5, "1234567890") != 7) {
*error_message = "invalid ISRC number";
return false;
......
......@@ -109,7 +109,7 @@ FILE "z.wav" WAVE
INDEX 98 03:42:58
INDEX 99 03:42:59
TRACK 03 AUDIO
ISRC ABCD76543210
ISRC AB-CD7-65-43210
INDEX 00 04:50:12
INDEX 01 04:51:72
TRACK 04 AUDIO
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment