From db55d30372a6f2f257f1c65948451db0854c34d4 Mon Sep 17 00:00:00 2001 From: Nick Peskett Date: Thu, 7 Apr 2022 09:08:50 +0000 Subject: Allow cuesheet index offsets longer than 99 minutes. While the track number is limited to 99, I know of no documented constraint on the value of offset minutes to 99. As we are storing the millisecond offset as unsigned long, assuming 32 bit, we can allow 70,000 minutes (2^32 / 60000). However, I've been unable to generate a test audio file 48 days long under 2GB, so I've set the limit to 30,000 minutes. In addition, this change reduces the maximum number of seconds to 59, and frames to 74. I've generated some silent test files with the filenames being cue_[minutes].mp3 http://peskett.co.uk/rockbox/test_cues/ Change-Id: I3ca4468ebc88ba134c4e785e9395f90bf76941ac --- apps/cuesheet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apps/cuesheet.c') diff --git a/apps/cuesheet.c b/apps/cuesheet.c index a9169d4494..98040f9992 100644 --- a/apps/cuesheet.c +++ b/apps/cuesheet.c @@ -123,6 +123,7 @@ static unsigned long parse_cue_index(const char *line) /* assumes strncmp(line, "INDEX 01", 8) & NULL terminated string */ /* INDEX 01 MM:SS:FF\0 (00:00:00\0 - 99:99:99\0)*/ const unsigned field_m[3] = {60 * 1000, 1000, 13}; /* MM:SS:~FF*/ + const unsigned field_max[3] = {30000, 59, 74}; /* MM, SS, FF */ const char f_sep = ':'; int field = -1; unsigned long offset = 0; /* ms from start of track */ @@ -138,7 +139,7 @@ static unsigned long parse_cue_index(const char *line) while (isdigit(*line)) { value = 10 * value + (*line - '0'); - if (value > 99) /* Sanity check bail early */ + if (value > field_max[field]) /* Sanity check bail early */ return 0; line++; } -- cgit v1.2.3