Commit 0d903aab authored by Josh Coalson's avatar Josh Coalson

fix bug in cuesheet parsing where it would return an error if the last line of...

fix bug in cuesheet parsing where it would return an error if the last line of the cuesheet did not end with a newline
parent ce0b3452
......@@ -57,6 +57,92 @@
<br /><br />
<a name="flac_1_1_3"><b>FLAC 1.1.3</b></a>
<br />
<ul>
<li>
General:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
FLAC format:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
Ogg FLAC format:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
flac:
<ul>
<li>Fixed a bug in cuesheet parsing where it would return an error if the last line of the cuesheet did not end with a newline.</li>
</ul>
</li>
<li>
metaflac:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
plugins:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
build system:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
libraries:
<ul>
<li>libFLAC: Fixed a bug in cuesheet parsing where it would return an error if the last line of the cuesheet did not end with a newline.</li>
</ul>
</li>
<li>
Interface changes:
<ul>
<li>
libFLAC:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
libFLAC++:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
libOggFLAC:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
libOggFLAC++:
<ul>
<li>(none)</li>
</ul>
</li>
</ul>
</li>
</ul>
<br />
<a name="flac_1_1_2"><b>FLAC 1.1.2</b></a>
<br />
......
......@@ -202,7 +202,7 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message,
#define FLAC__STRCASECMP strcasecmp
#endif
char buffer[4096], *line, *field;
unsigned linelen, forced_leadout_track_num = 0;
unsigned forced_leadout_track_num = 0;
FLAC__uint64 forced_leadout_track_offset = 0;
int in_track_num = -1, in_index_num = -1;
FLAC__bool disc_has_catalog = false, track_has_flags = false, track_has_isrc = false, has_forced_leadout = false;
......@@ -215,10 +215,12 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message,
(*last_line_read)++;
line = buffer;
linelen = strlen(line);
if(line[linelen-1] != '\n') {
*error_message = "line too long";
return false;
{
size_t linelen = strlen(line);
if((linelen == sizeof(buffer)-1) && line[linelen-1] != '\n') {
*error_message = "line too long";
return false;
}
}
if(0 != (field = local__get_field_(&line, /*allow_quotes=*/false))) {
......
......@@ -88,3 +88,6 @@ NEGATIVE cuesheets/bad.235.FLAC_leadout_offset_not_211680000.cue
pass1: parse error, line 1: "FLAC__lead-out offset does not match end-of-stream offset"
POSITIVE cuesheets/good.000.cue
POSITIVE cuesheets/good.001.cue
POSITIVE cuesheets/good.002.dos_format.cue
POSITIVE cuesheets/good.003.missing_final_newline.cue
POSITIVE cuesheets/good.004.dos_format.missing_final_newline.cue
CATALOG "1234567890123"
FILE "z.wav" WAVE
TRACK 01 AUDIO
INDEX 01 00:00:00
CATALOG "1234567890123"
FILE "z.wav" WAVE
TRACK 01 AUDIO
INDEX 01 00:00:00
\ No newline at end of file
CATALOG "1234567890123"
FILE "z.wav" WAVE
TRACK 01 AUDIO
INDEX 01 00:00:00
\ No newline at end of file
Markdown is supported
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